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

HCAL: adding Phase 1 HBX/HEX channels to CalibDetId and ASCII conditions processing #26432

Merged
merged 2 commits into from Apr 17, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
25 changes: 24 additions & 1 deletion CalibFormats/HcalObjects/src/HcalText2DetIdConverter.cc
Expand Up @@ -158,7 +158,17 @@ bool HcalText2DetIdConverter::init (DetId fId) {
setField (1, calibId.rm());
setField (2, calibId.fiber());
setField (3, calibId.channel());
}
} else if ( calibId.calibFlavor()==HcalCalibDetId::HBX) {
flavorName="HBX";
setField (1, calibId.ieta());
setField (2, calibId.iphi());
setField (3, calibId.depth());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason that you are assigning a depth here (and in the HEX channels) rather than using a dummy value of -999 as in the HOX channels in L145? The depth value isn't meaningful as these channels do not read out any scintillator.

} else if ( calibId.calibFlavor()==HcalCalibDetId::HEX) {
flavorName="HEX";
setField (1, calibId.ieta());
setField (2, calibId.iphi());
setField (3, calibId.depth());
}
}
else {
flavorName = "UNKNOWN_FLAVOR";
Expand Down Expand Up @@ -234,6 +244,19 @@ bool HcalText2DetIdConverter::init (const std::string& fFlavor, const std::strin
int iphi=getField(2);
mId = HcalCalibDetId (ieta,iphi);
}
else if (flavorName=="HBX") {
int ieta=getField(1);
int iphi=getField(2);
int depth=getField(3);
mId = HcalCalibDetId (HcalCalibDetId::HBX, ieta, iphi, depth);
}
else if (flavorName=="HEX") {
int ieta=getField(1);
int iphi=getField(2);
int depth=getField(3);
mId = HcalCalibDetId (HcalCalibDetId::HEX, ieta, iphi, depth);

}
else if (flavorName=="UMNQIE") {
int channel=getField(1);
mId = HcalCalibDetId (HcalCalibDetId::uMNqie,channel);
Expand Down
19 changes: 16 additions & 3 deletions DataFormats/HcalDetId/interface/HcalCalibDetId.h
Expand Up @@ -8,7 +8,7 @@
/** \class HcalCalibDetId
*
* Contents of the HcalCalibDetId :
* [19:17] Calibration Category (1 = CalibUnit, 2 = HX, 3=uMNio/qie, 4=CastorRad)
* [19:17] Calibration Category (1 = CalibUnit, 2 = HOX, 3=uMNio/qie, 4=CastorRad, 5=LASMON, 6=HBX, 7=HEX)
*
* For CalibUnit:
* [16:14] Subdetector
Expand All @@ -29,13 +29,24 @@
* [9:5] fiber-in-rm
* [4:0] channel-on-fiber
*
* For Laser Monitoring channels:
* [16:10] ieta
* [9:5] iphi
* [3:0] cbox
*
* For HBX/HEX:
* [19:17] 6 or 7 (CalibType)
* [15:15] 0/1 (Side)
* [14:10] ieta (1-29)
* [9:3] iphi (1-72)
* [2:0] depth (1-7)
*
* \author J. Mans - Minnesota
*/
class HcalCalibDetId : public HcalOtherDetId {
public:
/** Type identifier within calibration det ids */
enum CalibDetType { CalibrationBox = 1, HOCrosstalk = 2, uMNqie = 3, CastorRadFacility = 4, LASERMON = 5 };
enum CalibDetType { CalibrationBox = 1, HOCrosstalk = 2, uMNqie = 3, CastorRadFacility = 4, LASERMON = 5, HBX = 6, HEX = 7 };

/** Create a null det id */
HcalCalibDetId();
Expand All @@ -50,7 +61,7 @@ class HcalCalibDetId : public HcalOtherDetId {
HcalCalibDetId(int ieta, int iphi);
/** Construct a uMNqie id or other id which uses a single value plus a DetType */
HcalCalibDetId(CalibDetType dt, int value);
/** Construct a Castor radiation test facility id or other id which uses three values plus a DetType */
/** Construct a Castor radiation test facility id or other id which uses three values plus a DetType */
HcalCalibDetId(CalibDetType dt, int value1, int value2, int value3);

/// get the flavor of this calibration detid
Expand Down Expand Up @@ -79,6 +90,8 @@ class HcalCalibDetId : public HcalOtherDetId {

/// get the sign of ieta (+/-1)
int zside() const;
/// get the depth (where relevant)
int depth() const;

/// constants
static const int cbox_MixerHigh = 0; // HB/HE/HO/HF
Expand Down
40 changes: 29 additions & 11 deletions DataFormats/HcalDetId/src/HcalCalibDetId.cc
Expand Up @@ -27,10 +27,10 @@ HcalCalibDetId::HcalCalibDetId(HcalSubdetector subdet, int ieta, int iphi, int c
}

HcalCalibDetId::HcalCalibDetId(int ieta, int iphi) : HcalOtherDetId(HcalCalibration) {
id_|=(HOCrosstalk<<17); // Calibration Category, bits [17:19] (= "2" for HOX)
id_|=(iphi&0x7F) // phi index, bits [0:6]
|((abs(ieta)&0xF)<<7) // eta index, bits [7:10]
|(((ieta > 0)?(1):(0))<<11); // z side, bit [11]
id_|=(HOCrosstalk<<17); // Calibration Category, bits [17:19] (= "2" for HOX)
id_|=(iphi&0x7F) // phi index, bits [0:6]
|((abs(ieta)&0xF)<<7) // eta index, bits [7:10]
|(((ieta > 0)?(1):(0))<<11); // z side, bit [11]
}

HcalCalibDetId::HcalCalibDetId(CalibDetType dt, int value) : HcalOtherDetId(HcalCalibration) {
Expand All @@ -39,10 +39,19 @@ HcalCalibDetId::HcalCalibDetId(CalibDetType dt, int value) : HcalOtherDetId(Hcal
}

HcalCalibDetId::HcalCalibDetId(CalibDetType dt, int value1, int value2, int value3) : HcalOtherDetId(HcalCalibration) {
id_|=(dt<<17);
id_|=(value1&0x3F)<<10;
id_|=(value2&0x1F)<<5;
id_|=(value3&0x1F);
id_|=(dt<<17); // Calibration Category, bits [17:19]

if(dt == HBX || dt == HEX) {
id_|=(value3&0x7) // depth index, bits [0:2]
|((value2&0x7F)<<3) // phi index, bits [3:9]
|((value1&0x1F)<<10) // eta index, bits [10:14]
|(((value1 > 0)?(1):(0))<<15); // z side, bit [15]
}
else {
id_|=(value1&0x3F)<<10;
id_|=(value2&0x1F)<<5;
id_|=(value3&0x1F);
}
}

HcalCalibDetId::HcalCalibDetId(const DetId& gen) {
Expand Down Expand Up @@ -75,17 +84,22 @@ HcalSubdetector HcalCalibDetId::hcalSubdet() const {
}

int HcalCalibDetId::ieta() const {
return (calibFlavor()==CalibrationBox)?(((id_>>11)&0x7)-2):((calibFlavor()==HOCrosstalk)?(((id_>>7)&0xF)*zside()):(calibFlavor()==LASERMON?((id_>>10)&0x3F):(0)));
return (calibFlavor()==CalibrationBox)?(((id_>>11)&0x7)-2):((calibFlavor()==HOCrosstalk)?(((id_>>7)&0xF)*zside()):(calibFlavor()==LASERMON?((id_>>10)&0x3F):(((calibFlavor()==HBX || calibFlavor()==HEX)?((id_>>10)&0x1F)*zside():(0)))));
}

int HcalCalibDetId::iphi() const {
return (calibFlavor()==CalibrationBox)?((id_>>4)&0x7F):((calibFlavor()==HOCrosstalk)?(id_&0x7F):(calibFlavor()==LASERMON?((id_>>5)&0x1F):(0)));
return (calibFlavor()==CalibrationBox)?((id_>>4)&0x7F):((calibFlavor()==HOCrosstalk)?(id_&0x7F):(calibFlavor()==LASERMON?((id_>>5)&0x1F):(((calibFlavor()==HBX || calibFlavor()==HEX)?((id_>>3)&0x7F):(0)))));
}

int HcalCalibDetId::zside() const {
return (calibFlavor()==HOCrosstalk)?(((id_>>11)&0x1)?(1):(-1)):(0);
return (calibFlavor()==HOCrosstalk)?(((id_>>11)&0x1)?(1):(-1)):((calibFlavor()==HBX || calibFlavor()==HEX)?((id_>>15)&0x1)?(1):(-1):(0));
}

int HcalCalibDetId::depth() const {
return (calibFlavor()==HBX || calibFlavor()==HEX)?(id_&0x7):(0);
}


std::string HcalCalibDetId::cboxChannelString() const {
switch (cboxChannel()) {
case(cbox_MixerHigh): return "Mixer-High";
Expand Down Expand Up @@ -130,6 +144,10 @@ std::ostream& operator<<(std::ostream& s,const HcalCalibDetId& id) {
return s << "(LASERMON" << id.channel() << ')';
case (HcalCalibDetId::CastorRadFacility):
return s << "(CastorRadFacility " << id.rm() << " / " << id.fiber() << " / " << id.channel() << ')';
case (HcalCalibDetId::HBX):
return s << "(HBX " << id.ieta() << "," << id.iphi() << "," << id.depth() << ")";
case (HcalCalibDetId::HEX):
return s << "(HEX " << id.ieta() << "," << id.iphi() << "," << id.depth() << ")";
default: return s;
};
}