Skip to content

Commit

Permalink
Merge pull request #23084 from mmusich/sistripCondTools_update_102X
Browse files Browse the repository at this point in the history
Update SiStrip Miscalibration Tools [10.2.X]
  • Loading branch information
cmsbuild committed May 2, 2018
2 parents 6f529cf + 2b21392 commit 3ca9716
Show file tree
Hide file tree
Showing 11 changed files with 1,334 additions and 184 deletions.
8 changes: 8 additions & 0 deletions CondTools/SiStrip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,11 @@
- To run:
- `cmsRun test/SiStripApvGainReader_cfg.py inputFiles=sqlite_input tag=my_tag runN=run_in_IOV`
- `readSiStripApvGain.py inputFiles=sqlite_input tag=my_tag runN=run_in_IOV`

- _SiStripChannelGainFromDBMiscalibrator_: reads APV gains (either G1 or G2) from DB and applies hierarchically a scale factor and/or gaussian smearing for each APV gain, down to the individual layer or disk level
- To run:
- `cmsRun test/SiStripChannelGainFromDBMiscalibrator_cfg.py globalTag=<inputGT> runNumber=<inputIOV>`

- _SiStripNoisesFromDBMiscalibrator_: reads Noise from DB and applies hierarchically a scale factor and/or gaussian smearing for each APV gain, down to the individual layer or disk level
- To run:
- `cmsRun test/SiStripNoiseFromDBMiscalibrator_cfg.py globalTag=<inputGT> runNumber=<inputIOV>`
79 changes: 79 additions & 0 deletions CondTools/SiStrip/interface/SiStripMiscalibrateHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#ifndef CONDTOOLS_SISTRIP_SISTRIPMISCALIBRATEHELPER
#define CONDTOOLS_SISTRIP_SISTRIPMISCALIBRATEHELPER

#include <numeric>
#include "CommonTools/TrackerMap/interface/TrackerMap.h"
#include "CondFormats/SiStripObjects/interface/SiStripSummary.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"

namespace SiStripMiscalibrate {

/*-----------------
/ Auxilliary class to store averages and std. deviations
/------------------*/
class Entry{
public:
Entry():
entries(0),
sum(0),
sq_sum(0){}

double mean() {return sum / entries;}
double std_dev() {
double tmean = mean();
return (sq_sum - entries*tmean*tmean)>0 ? sqrt((sq_sum - entries*tmean*tmean)/(entries-1)) : 0.;
}
double mean_rms() { return std_dev()/sqrt(entries); }

void add(double val){
entries++;
sum += val;
sq_sum += val*val;
}

void reset() {
entries = 0;
sum = 0;
sq_sum = 0;
}
private:
long int entries;
double sum, sq_sum;
};

/*-----------------
/ Auxilliary struct to store scale & smear factors
/------------------*/
struct Smearings{
Smearings(){
m_doScale = false;
m_doSmear = false;
m_scaleFactor = 1.;
m_smearFactor = 0.;
}
~Smearings(){}

void setSmearing(bool doScale,bool doSmear,double the_scaleFactor,double the_smearFactor){
m_doScale = doScale;
m_doSmear = doSmear;
m_scaleFactor = the_scaleFactor;
m_smearFactor = the_smearFactor;
}

bool m_doScale;
bool m_doSmear;
double m_scaleFactor;
double m_smearFactor;
};

/*-----------------
/ Methods used in the miscalibration tools
/------------------*/

std::pair<float,float> getTruncatedRange(const TrackerMap* theMap);
sistripsummary::TrackerRegion getRegionFromString(std::string region);
std::vector<sistripsummary::TrackerRegion> getRegionsFromDetId(const TrackerTopology* m_trackerTopo,DetId detid);

};

#endif
1 change: 1 addition & 0 deletions CondTools/SiStrip/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<use name="CalibTracker/Records"/>
<use name="CondCore/DBOutputService"/>
<use name="CondFormats/SiStripObjects"/>
<use name="CondCore/SiStripPlugins"/>
<use name="CalibFormats/SiStripObjects"/>
<use name="DataFormats/SiStripDetId"/>
<use name="CalibTracker/SiStripCommon"/>
Expand Down

0 comments on commit 3ca9716

Please sign in to comment.