Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New pulse shape for HE 2017 SiPM #15322

Merged
merged 4 commits into from Aug 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -11,7 +11,7 @@ class HcalHardcodeParameters {
HcalHardcodeParameters() {}
//construct from values
HcalHardcodeParameters(double pedestal, double pedestalWidth, std::vector<double> gain, std::vector<double> gainWidth,
int qieType, std::vector<double> qieOffset, std::vector<double> qieSlope);
int qieType, std::vector<double> qieOffset, std::vector<double> qieSlope, int mcShape, int recoShape);
//construct from pset
HcalHardcodeParameters(const edm::ParameterSet & p);

Expand All @@ -27,13 +27,16 @@ class HcalHardcodeParameters {
const int qieType() const { return qieType_; }
const double qieOffset(unsigned range) const { return qieOffset_.at(range); }
const double qieSlope(unsigned range) const { return qieSlope_.at(range); }
const int mcShape() const { return mcShape_; }
const int recoShape() const { return recoShape_; }

private:
//member variables
double pedestal_, pedestalWidth_;
std::vector<double> gain_, gainWidth_;
int qieType_;
std::vector<double> qieOffset_, qieSlope_;
int mcShape_, recoShape_;
};

#endif
8 changes: 4 additions & 4 deletions CalibCalorimetry/HcalAlgos/interface/HcalPulseShapes.h
Expand Up @@ -20,15 +20,15 @@ class HcalPulseShapes {
typedef HcalPulseShape Shape;
HcalPulseShapes();
~HcalPulseShapes();
// only needed if you'll be geting shapes by DetId
// only needed if you'll be getting shapes by DetId
void beginRun(edm::EventSetup const & es);
void endRun();

const Shape& hbShape() const { return hpdShape_; }
const Shape& heShape() const { return hpdShape_; }
const Shape& hfShape() const { return hfShape_; }
const Shape& hoShape(bool sipm=false) const { return sipm ? siPMShape_ : hpdShape_; }
// return Shpape for given shapeType.
// return Shape for given shapeType.
const Shape& getShape(int shapeType) const;
/// automatically figures out which shape to return
const Shape& shape(const HcalDetId & detId) const;
Expand All @@ -38,10 +38,10 @@ class HcalPulseShapes {
private:
void computeHPDShape(float, float, float, float, float ,
float, float, float, Shape&);
// void computeHPDShape();
void computeHFShape();
void computeSiPMShape();
Shape hpdShape_, hfShape_, siPMShape_;
void computeSiPMShape2017();
Shape hpdShape_, hfShape_, siPMShape_, siPMShape2017_;
Shape hpdShape_v2, hpdShapeMC_v2;
Shape hpdShape_v3, hpdShapeMC_v3;
Shape hpdBV30Shape_v2, hpdBV30ShapeMC_v2;
Expand Down
134 changes: 33 additions & 101 deletions CalibCalorimetry/HcalAlgos/src/HcalDbHardcode.cc
Expand Up @@ -10,7 +10,7 @@
#include "DataFormats/HcalDigi/interface/HcalQIENum.h"

HcalDbHardcode::HcalDbHardcode()
: theDefaultParameters_(3.0,0.5,{0.2,0.2},{0.0,0.0},0,{0.0,0.0,0.0,0.0},{0.9,0.9,0.9,0.9}), //"generic" set of conditions
: theDefaultParameters_(3.0,0.5,{0.2,0.2},{0.0,0.0},0,{0.0,0.0,0.0,0.0},{0.9,0.9,0.9,0.9},125,105), //"generic" set of conditions
setHB_(false), setHE_(false), setHF_(false), setHO_(false),
setHBUpgrade_(false), setHEUpgrade_(false), setHFUpgrade_(false),
useHBUpgrade_(false), useHEUpgrade_(false), useHFUpgrade_(false), testHFQIE10_(false)
Expand Down Expand Up @@ -70,7 +70,7 @@ HcalPedestal HcalDbHardcode::makePedestal (HcalGenericDetId fId, bool fSmear) {
value[i] = 0.0f;
while (value [i] <= 0.0f)
// ignore correlations, assume 10K pedestal run
value [i] = value0 + (float)CLHEP::RandGauss::shoot (value0, width.getWidth (i) / 100.);
value [i] = value0 + (float)CLHEP::RandGauss::shoot (0.0, width.getWidth (i) / 100.);
}
}
HcalPedestal result (fId.rawId (),
Expand Down Expand Up @@ -152,86 +152,52 @@ HcalQIEShape HcalDbHardcode::makeQIEShape () {

HcalMCParam HcalDbHardcode::makeMCParam (HcalGenericDetId fId) {


/*
std::cout << std::endl << " HcalDbHardcode::makeMCParam fId "
<< fId
<< " fId.genericSubdet() = " << fId.genericSubdet() << std::endl;
if(fId.isHcalZDCDetId()) {
std::cout << "... ZDC " << std::endl;


HcalZDCDetId cell(fId);
int side = cell.zside();
int depth = cell.depth();
int ch = cell.channel();
std::cout << "ZDC side/depth/chanel = "
<< side << " " << depth << " " << ch
<< std::endl;
}
else if (fId.isHcalDetId()) {
HcalDetId cell = HcalDetId(fId);
int sub = cell.subdet();
int dep = cell.depth();
int ieta = cell.ieta();
int iphi = cell.iphi();

std::cout << " HCAL "
<< " subdet " << sub << " ieta " << ieta << " iphi " << iphi
<< " depth " << dep << std::endl;
}
else { std::cout << "...Something else ! " << std::endl; }

*/

int r1bit[5];
int pulseShapeID = 125; r1bit[0] = 9; // [0,9]
r1bit[0] = 9; // [0,9]
int syncPhase = 0; r1bit[1] = 1;
int binOfMaximum = 0; r1bit[2] = 4;
float phase = -25.0f; // [-25.0,25.0]
float Xphase = (phase + 32.0f) * 4.0f; // never change this line
// (offset 50nsec, 0.25ns step)
int Iphase = Xphase; r1bit[3] = 8; // [0,256] offset 50ns, .25ns step
int timeSmearing = 0; r1bit[4] = 1; // bool


const HcalHardcodeParameters& hparam(getParameters(fId));
int pulseShapeID = hparam.mcShape(); // a0

if (fId.genericSubdet() == HcalGenericDetId::HcalGenBarrel) {

syncPhase = 1; // a0 bool
binOfMaximum = 5; // a1
phase = 5.0f; // a2 [-25.0,25.0]
syncPhase = 1; // a1 bool
binOfMaximum = 5; // a2
phase = 5.0f; // a3 [-25.0,25.0]
Xphase = (phase + 32.0f) * 4.0f; // never change this line
// (offset 50nsec, 0.25ns step)
Iphase = Xphase;
timeSmearing = 1; // a3
pulseShapeID = 201; // a4 201 - Zecotec shape
// 202 - Hamamatsu
timeSmearing = 1; // a4

}

else if (fId.genericSubdet() == HcalGenericDetId::HcalGenEndcap) {

syncPhase = 1; // a0 bool
binOfMaximum = 5; // a1
phase = 5.0f; // a2 [-25.0,25.0]
syncPhase = 1; // a1 bool
binOfMaximum = 5; // a2
phase = 5.0f; // a3 [-25.0,25.0]
Xphase = (phase + 32.0f) * 4.0f; // never change this line
// (offset 50nsec, 0.25ns step)
Iphase = Xphase;
timeSmearing = 1; // a3
pulseShapeID = 201; // a4
timeSmearing = 1; // a4

}

else if (fId.genericSubdet() == HcalGenericDetId::HcalGenOuter) {

syncPhase = 1; // a0 bool
binOfMaximum = 5; // a1
phase = 5.0f; // a2 [-25.0,25.0]
syncPhase = 1; // a1 bool
binOfMaximum = 5; // a2
phase = 5.0f; // a3 [-25.0,25.0]
Xphase = (phase + 32.0f) * 4.0f; // never change this line
// (offset 50nsec, 0.25ns step)
Iphase = Xphase;
timeSmearing = 0; // a3
pulseShapeID = 201; // a4
timeSmearing = 0; // a4

HcalDetId cell = HcalDetId(fId);
if (cell.ieta() == 1 && cell.iphi() == 1) pulseShapeID = 125;
Expand All @@ -240,29 +206,26 @@ HcalMCParam HcalDbHardcode::makeMCParam (HcalGenericDetId fId) {

else if (fId.genericSubdet() == HcalGenericDetId::HcalGenForward) {

syncPhase = 1; // a0 bool
binOfMaximum = 3; // a1
phase = 14.0f; // a2 [-25.0,25.0]
syncPhase = 1; // a1 bool
binOfMaximum = 3; // a2
phase = 14.0f; // a3 [-25.0,25.0]
Xphase = (phase + 32.0f) * 4.0f; // never change this line
// (offset 50nsec, 0.25ns step)
Iphase = Xphase;
timeSmearing = 0; // a3
pulseShapeID = 301; // a4
timeSmearing = 0; // a4

}

else if (fId.genericSubdet() == HcalGenericDetId::HcalGenZDC) {

// std::cout << " >>> ZDC " << std::endl;

syncPhase = 1; // a0 bool
binOfMaximum = 5; // a1
phase = -4.0f; // a2 [-25.0,25.0]
pulseShapeID = 401; // a0
syncPhase = 1; // a1 bool
binOfMaximum = 5; // a2
phase = -4.0f; // a3 [-25.0,25.0]
Xphase = (phase + 32.0f) * 4.0f; // never change this line
// (offset 50nsec, 0.25ns step)
Iphase = Xphase;
timeSmearing = 0; // a3
pulseShapeID = 401; // a4
timeSmearing = 0; // a4

}

Expand All @@ -273,7 +236,7 @@ HcalMCParam HcalDbHardcode::makeMCParam (HcalGenericDetId fId) {
rshift[k+1]=rshift[k]+r1bit[k];
}

int packingScheme = 1;
int packingScheme = 1; // a5
unsigned int param = pulseShapeID |
syncPhase<<rshift[1] |
(binOfMaximum << rshift[2]) |
Expand All @@ -300,7 +263,10 @@ HcalRecoParam HcalDbHardcode::makeRecoParam (HcalGenericDetId fId) {
// (offset 50ns, 0.25ns step
int firstSample = 4; p1bit[3]=4; // [0,9]
int samplesToAdd = 2; p1bit[4]=4; // [0,9]
int pulseShapeID = 105; p1bit[5]=9; // [0,9]
p1bit[5]=9; // [0,9]

const HcalHardcodeParameters& hparam(getParameters(fId));
int pulseShapeID = hparam.recoShape(); // a5

int q2bit[10];
// param2.
Expand All @@ -327,7 +293,6 @@ HcalRecoParam HcalDbHardcode::makeRecoParam (HcalGenericDetId fId) {
Iphase = Xphase; // p2
firstSample = 4; // p3
samplesToAdd = 2; // p4
pulseShapeID = 201; // p5

// param2.
useLeakCorrection = 0; // q0
Expand All @@ -352,7 +317,7 @@ HcalRecoParam HcalDbHardcode::makeRecoParam (HcalGenericDetId fId) {
Iphase = Xphase; // p2
firstSample = 4; // p3
samplesToAdd = 4; // p4
pulseShapeID = 201; // p5

// param2.
useLeakCorrection = 0; // q0
LeakCorrectionID = 0; // q1
Expand All @@ -373,11 +338,8 @@ HcalRecoParam HcalDbHardcode::makeRecoParam (HcalGenericDetId fId) {
float Xphase = (phase + 32.0) * 4.0; // never change this line
// (offset 50nsec, 0.25ns step)
Iphase = Xphase; // p2
pulseShapeID = 301; // p5

firstSample = 2; // p3
samplesToAdd = 1; // p4
pulseShapeID = 301; // p5

// param2.
useLeakCorrection = 0; // q0
Expand Down Expand Up @@ -426,36 +388,6 @@ HcalRecoParam HcalDbHardcode::makeRecoParam (HcalGenericDetId fId) {
(pileupCleaningID << q2shift[8]) |
(packingScheme << q2shift[9]) ;

// Test printout
/*
int a0=param1%2;
int a1=(param1/2)%2;
int a2=(param1/(2*2))%256;
int a3=(param1/(2*2*256))%16;
int a4=(param1/(2*2*256*16))%16;
int a5=(param1/(2*2*256*16*16))%512;
a2=(a2/4)-32;

int b0=param2%2;
int b1=(param2/2)%16;
int b2=(param2/(2*16))%2;
int b3=(param2/(2*16*2))%16;
int b4=(param2/(2*16*2*16))%2;
int b5=(param2/(2*16*2*16*2))%16;
int b6=(param2/(2*16*2*16*2*16))%16;
int b7=(param2/(2*16*2*16*2*16*16))%16;
int b8=(param2/(2*16*2*16*2*16*16*16))%16;
int b9=(param2/(2*16*2*16*2*16*16*16*16))%16;

std::cout << " param1 (a012) " << a0 << " " <<a1 << " " << a2
<< " (a345) " << a3 << " " << a4 << " "<< a5
<< " param2 (b012) " << b0 << " " << b1 << " " <<b2
<< " (b345) " << b3 << " " << b4 << " " << b5
<< " (b678) " << b6 << " " << b7 << " " << b8 << " b9 " << b9
<< std::endl;
*/


HcalRecoParam result(fId.rawId(), param1, param2);

return result;
Expand Down
10 changes: 7 additions & 3 deletions CalibCalorimetry/HcalAlgos/src/HcalHardcodeParameters.cc
@@ -1,14 +1,16 @@
#include "CalibCalorimetry/HcalAlgos/interface/HcalHardcodeParameters.h"

HcalHardcodeParameters::HcalHardcodeParameters(double pedestal, double pedestalWidth, std::vector<double> gain, std::vector<double> gainWidth,
int qieType, std::vector<double> qieOffset, std::vector<double> qieSlope)
int qieType, std::vector<double> qieOffset, std::vector<double> qieSlope, int mcShape, int recoShape)
: pedestal_(pedestal),
pedestalWidth_(pedestalWidth),
gain_(gain),
gainWidth_(gainWidth),
qieType_(qieType),
qieOffset_(qieOffset),
qieSlope_(qieSlope)
qieSlope_(qieSlope),
mcShape_(mcShape),
recoShape_(recoShape)
{
}

Expand All @@ -19,6 +21,8 @@ HcalHardcodeParameters::HcalHardcodeParameters(const edm::ParameterSet & p)
gainWidth_(p.getParameter<std::vector<double>>("gainWidth")),
qieType_(p.getParameter<int>("qieType")),
qieOffset_(p.getParameter<std::vector<double>>("qieOffset")),
qieSlope_(p.getParameter<std::vector<double>>("qieSlope"))
qieSlope_(p.getParameter<std::vector<double>>("qieSlope")),
mcShape_(p.getParameter<int>("mcShape")),
recoShape_(p.getParameter<int>("recoShape"))
{
}