8 #ifndef LARCALIBUTILS_LAROFCALGORITHM_H
9 #define LARCALIBUTILS_LAROFCALGORITHM_H
13 #include "GaudiKernel/ToolHandle.h"
21 #include <Eigen/Dense>
23 #include "tbb/blocked_range.h"
24 #include "tbb/global_control.h"
44 LArOFCAlg (
const std::string&
name, ISvcLocator* pSvcLocator);
56 ,
"CaloDetDescrManager"
57 ,
"CaloDetDescrManager"
58 ,
"SG Key for CaloDetDescrManager in the Condition Store" };
61 ,
"CaloSuperCellDetDescrManager"
62 ,
"CaloSuperCellDetDescrManager"
63 ,
"SG Key for CaloSuperCellDetDescrManager in the Condition Store" };
72 std::vector<std::vector<float> >
ofc_a;
73 std::vector<std::vector<float> >
ofc_b;
78 std::vector<std::vector<float> >
shape;
89 inputWave(wave), chid(hi),
gain(
g),
tstart(0), timeBinWidthOFC(25./24), phasewMaxAt3(0), faultyOFC(false), shortWave(false) {};
96 static void optFilt(
const std::vector<float> &gWave_in,
const std::vector<float> &gDerivWave_in,
const Eigen::MatrixXd& autoCorrInv,
97 std::vector<float>& OFCa, std::vector<float>& OFCb
100 static void optFiltDelta(
const std::vector<float> &gWave_in,
const std::vector<float> &gDerivWave_in,
const Eigen::MatrixXd& autoCorrInv,
101 const Eigen::VectorXd& delta,
102 std::vector<float>& vecOFCa, std::vector<float>& vecOFCb
105 static void optFiltPed(
const std::vector<float> &gWave_in,
const std::vector<float> &gDerivWave_in,
const Eigen::MatrixXd& autoCorrInv,
106 std::vector<float>& OFCa, std::vector<float>& OFCb
112 bool verify(
const HWIdentifier chid,
const std::vector<float>& OFCa,
const std::vector<float>& OFCb,
113 const std::vector<float>& Shape,
const char* ofcversion,
const unsigned phase)
const;
115 static void printOFCVec(
const std::vector<float>&
vec, MsgStream& mLog) ;
121 unsigned int m_nPoints{0};
123 StringProperty m_dumpOFCfile{
this,
"DumpOFCfile",
""};
124 StringArrayProperty m_keylist{
this,
"KeyList", {},
"List of keys to process"};
125 BooleanProperty m_verify{
this,
"Verify",
true,
"Verufy OFCs after computation"};
126 BooleanProperty m_normalize{
this,
"Normalize",
false,
"Normalize input wave"};
127 BooleanProperty m_timeShift{
this,
"TimeShift",
false,
"Shifting input wave"};
128 IntegerProperty m_timeShiftByIndex{
this,
"TimeShiftByIndex", -1,
"shifting by n bins input wave"} ;
133 UnsignedIntegerProperty m_nSamples{
this,
"Nsample", 5,
"How many sample to compute"};
134 UnsignedIntegerProperty m_nPhases{
this,
"Nphase", 50,
"How many sphases to compute"};
135 UnsignedIntegerProperty m_dPhases{
this,
"Dphase", 1,
"Number of samples between two neighboring phases (OFC sets)"};
136 UnsignedIntegerProperty m_nDelays{
this,
"Ndelay", 24,
"Number of delays in one clock"};
137 FloatProperty m_addOffset{
this,
"AddTimeOffset", 0.,
"Time offset to add"} ;
139 ToolHandle<ILArAutoCorrDecoderTool> m_AutoCorrDecoder{
this,
"DecoderTool",{} };
140 ToolHandle<ILArAutoCorrDecoderTool> m_AutoCorrDecoderV2{
this,
"DecoderToolV2", {} };
146 DoubleProperty m_errAmpl{
this,
"ErrAmplitude", 0.01,
"Allowed amplitude difference in check"};
147 DoubleProperty m_errTime{
this,
"ErrTime", 0.01,
"Allowed time difference in check"};
149 BooleanProperty m_readCaliWave{
this,
"ReadCaliWave",
true,
"If false PhysWave is input"};
150 BooleanProperty m_fillShape{
this,
"FillShape",
false,
"Fill also shape object"};
151 StringProperty m_ofcKey{
this,
"KeyOFC",
"LArOFC",
"Output key non-pileup OFCs"};
152 StringProperty m_ofcKeyV2{
this,
"KeyOFCV2",
"LArOFCV2",
"Output key pileup OFCs"};
153 StringProperty m_shapeKey{
this,
"KeyShape",
"LArShape",
"Output key Shape object"};
154 BooleanProperty m_storeMaxPhase{
this,
"StoreMaxPhase",
false,
"Store phase of input wave max.?"};
155 StringProperty m_ofcBinKey{
this,
"LArOFCBinKey",
"LArOFCPhase",
"Key for storing OFCBin object for MAx phase"};
157 StringProperty m_groupingType{
this,
"GroupingType",
"SubDetector",
"Which grouping type to use"};
158 StringProperty m_larPhysWaveBinKey{
this,
"LArPhysWaveBinKey",
"",
"Key for object to choose bin"};
160 IntegerProperty m_useDelta{
this,
"UseDelta", 0,
"0= not use Delta, 1=only EMECIW/HEC/FCAL, 2=all , 3 = only EMECIW/HEC/FCAL1+high eta FCAL2-3"};
161 IntegerProperty m_useDeltaV2{
this,
"UseDeltaV2", 0,
"Same af before for Delta"};
162 BooleanProperty m_computeV2{
this,
"ComputeOFCV2",
false,
"Compute pileup OFCs?"};
163 BooleanProperty m_computePed{
this,
"ComputeOFCPed",
false,
"Compute OFCs with additional constraint to pedestal?"};
164 IntegerProperty m_nThreads{
this,
"nThreads", -1,
"-1: No TBB, 0: Let TBB decide, >0 number of threads"};
166 BooleanProperty m_readDSPConfig{
this,
"ReadDSPConfig",
false,
"Read DSPConfig object ?"};
167 StringProperty m_DSPConfigFolder{
this,
"DSPConfigFolder",
"/LAR/Configuration/DSPConfiguration",
"Folder for DSPConfig object"};
170 BooleanProperty m_forceShift{
this,
"ForceShift",
false,
"Forcing shift of input wave ?"};
172 BooleanProperty m_isSC{
this,
"isSC",
false,
"Running on cells or supercells?"};
174 Eigen::VectorXd getDelta(std::vector<float>& samples,
const HWIdentifier chid,
unsigned nSamples)
const;
180 static const float m_fcal3Delta[5];
181 static const float m_fcal2Delta[5];
182 static const float m_fcal1Delta[5];
191 for (
size_t i=
r.begin();
i!=
r.end();++
i) {
192 m_ofcAlg->process(m_perChanData->at(
i),m_cabling);