CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalFeatureHFEMBit.cc
Go to the documentation of this file.
1 
2 //HcalFeatureHFEMBit
3 //version 2.0
4 
8 
9 
10 HcalFeatureHFEMBit::HcalFeatureHFEMBit(double ShortMinE, double LongMinE,
11  double ShortLongCutSlope, double ShortLongCutOffset, const HcalDbService& conditions) : conditions_(conditions)
12 {
13  ShortMinE_ = ShortMinE; //minimum energy deposited
14  LongMinE_ = LongMinE;
15  ShortLongCutSlope_ = ShortLongCutSlope; // this is a the slope of the cut line related to energy deposited in short fibers vrs long fibers
16  ShortLongCutOffset_ = ShortLongCutOffset; // this is the offset of said line.
17 
18 
19 
20 }
21 
23 
24 bool HcalFeatureHFEMBit::fineGrainbit(int ADCShort, HcalDetId Sid, int CapIdS, int ADCLong, HcalDetId Lid, int CapIdL) const//pass det id
25 {
26 
27  float ShortE = 0; //holds deposited energy
28  float LongE = 0;
29 
30 
31  HcalQIESample sQIESample(ADCShort, CapIdS, 1, 1);
32  //makes a QIE sample for the short fiber.
33  HFDataFrame shortf(Sid);
34  shortf.setSize(1); //not planning on there being anything else here at this point in time so setting the size to 1 shouldn't matter
35  shortf.setSample(0, sQIESample); //inputs data into digi.
36  const HcalCalibrations& calibrations = conditions_.getHcalCalibrations(Sid);
37  const HcalQIECoder* channelCoderS = conditions_.getHcalCoder(Sid);
38  const HcalQIEShape* shapeS = conditions_.getHcalShape(channelCoderS);
39 
40  HcalCoderDb coders(*channelCoderS, *shapeS);
41 
42  CaloSamples tools;
43  coders.adc2fC(shortf, tools);
44  ShortE = (tools[0] - calibrations.pedestal(CapIdS)) * calibrations.respcorrgain(CapIdS);
45 
46  HcalQIESample lQIESample(ADCLong, CapIdL, 1, 1);
47  HFDataFrame longf(Lid);
48  longf.setSize(1);
49  longf.setSample(0, lQIESample);
50  const HcalCalibrations& calibrationL = conditions_.getHcalCalibrations(Lid);
51 
52  CaloSamples tool_l;
53 
54  const HcalQIECoder* channelCoderL = conditions_.getHcalCoder(Lid);
55  const HcalQIEShape* shapeL = conditions_.getHcalShape(channelCoderL);
56 
57  HcalCoderDb coderL(*channelCoderL, *shapeL);
58 
59  coderL.adc2fC(longf, tool_l); // this fills tool_l[0] with linearized adc
60  LongE = (tool_l[0] - calibrationL.pedestal(CapIdL)) * calibrationL.respcorrgain(CapIdL);
61 
62 
63  // this actually does the cut
64  if((ShortE < ((LongE)-(ShortLongCutOffset_)) * ShortLongCutSlope_) && LongE > LongMinE_ && ShortE > ShortMinE_) return true;
65  else return false;
66 }
67 
68 
double respcorrgain(int fCapId) const
get response corrected gain for capid=0..3
double pedestal(int fCapId) const
get pedestal for capid=0..3
virtual void adc2fC(const HBHEDataFrame &df, CaloSamples &lf) const
Definition: HcalCoderDb.cc:44
void setSample(int i, const HcalQIESample &sam)
Definition: HFDataFrame.h:50
void setSize(int size)
Definition: HFDataFrame.cc:17
virtual bool fineGrainbit(int ADCShort, HcalDetId Sid, int CapIdS, int ADCLong, HcalDetId Lid, int CapIdL) const
HcalFeatureHFEMBit(double ShortMinE, double LongMinE, double ShortLongCutSlope, double ShortLongCutOffset, const HcalDbService &conditions)