-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23084 from mmusich/sistripCondTools_update_102X
Update SiStrip Miscalibration Tools [10.2.X]
- Loading branch information
Showing
11 changed files
with
1,334 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.