RecoTBCalo
EcalTBTDCReconstructor
src
EcalTBTDCRecInfoAlgo.cc
Go to the documentation of this file.
1
#include "
RecoTBCalo/EcalTBTDCReconstructor/interface/EcalTBTDCRecInfoAlgo.h
"
2
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
3
4
#include <list>
5
#include <iostream>
6
7
EcalTBTDCRecInfoAlgo::EcalTBTDCRecInfoAlgo
(
const
std::vector<EcalTBTDCRanges>&
tdcRanges
)
8
: tdcRanges_(
tdcRanges
), tdcRangeErrorMessageAlreadyDisplayed_(
false
), actualRun_(-1), actualRange_(-1) {}
9
10
EcalTBTDCRecInfo
EcalTBTDCRecInfoAlgo::reconstruct
(
const
EcalTBTDCRawInfo
& TDCRawInfo,
11
const
EcalTBEventHeader
& eventHeader,
12
bool
use2004OffsetConvention
)
const
{
13
if
(
actualRun_
!= eventHeader.
runNumber
()) {
14
actualRun_
= eventHeader.
runNumber
();
15
actualRange_
= -1;
16
for
(
unsigned
int
i
= 0;
i
<
tdcRanges_
.size();
i
++)
17
if
(eventHeader.
runNumber
() <=
tdcRanges_
[
i
].runRanges.second &&
18
eventHeader.
runNumber
() >=
tdcRanges_
[
i
].runRanges.first)
19
actualRange_
=
i
;
20
21
if
(
actualRange_
== -1) {
22
edm::LogError
(
"TDCRange not found"
) <<
"TDC range not found"
;
23
return
EcalTBTDCRecInfo
(-1);
24
}
25
}
26
27
int
eventType
;
28
eventType
= ((eventHeader.
dbEventType
() == 0) ? 0 : (eventHeader.
dbEventType
() - 1));
29
30
int
tdcd = TDCRawInfo[0].tdcValue();
31
32
if
(!
tdcRangeErrorMessageAlreadyDisplayed_
&&
33
(tdcd <
tdcRanges_
[
actualRange_
].
tdcMin
[
eventType
] || tdcd >
tdcRanges_
[
actualRange_
].
tdcMax
[
eventType
])) {
34
std::cout
<<
" ============================"
<< std::endl;
35
std::cout
<<
" Event type: "
<<
eventType
<< std::endl;
36
std::cout
<<
" TDC values not correctly set Raw TDC = "
<< tdcd
37
<<
" (Min/Max = "
<<
tdcRanges_
[
actualRange_
].tdcMin[
eventType
] <<
"/"
38
<<
tdcRanges_
[
actualRange_
].tdcMax[
eventType
] << std::endl;
39
std::cout
<<
" ============================"
<< std::endl;
40
tdcRangeErrorMessageAlreadyDisplayed_
=
true
;
41
}
42
43
double
offset
=
44
((double)tdcd - (
double
)
tdcRanges_
[
actualRange_
].tdcMin[
eventType
]) /
45
((
double
)
tdcRanges_
[
actualRange_
].tdcMax[
eventType
] - (double)
tdcRanges_
[
actualRange_
].
tdcMin
[
eventType
]);
46
if
(
use2004OffsetConvention
)
47
offset
= (1. -
offset
);
48
return
EcalTBTDCRecInfo
(
offset
);
49
}
EcalTBTDCRecInfoAlgo.h
mps_fire.i
i
Definition:
mps_fire.py:355
MessageLogger.h
funct::false
false
Definition:
Factorize.h:34
EcalTBTDCRecInfoAlgo::reconstruct
EcalTBTDCRecInfo reconstruct(const EcalTBTDCRawInfo &TDCRawInfo, const EcalTBEventHeader &eventHeader, bool use2004OffsetConvention) const
Definition:
EcalTBTDCRecInfoAlgo.cc:10
EcalTBTDCRecInfoAlgo::tdcRangeErrorMessageAlreadyDisplayed_
bool tdcRangeErrorMessageAlreadyDisplayed_
Definition:
EcalTBTDCRecInfoAlgo.h:30
Ecal2004TBTDCRanges_v1_cff.tdcRanges
tdcRanges
Definition:
Ecal2004TBTDCRanges_v1_cff.py:3
gather_cfg.cout
cout
Definition:
gather_cfg.py:144
EcalTBEventHeader
Definition:
EcalTBEventHeader.h:14
Ecal2004TBTDCRanges_cff.tdcMin
tdcMin
Definition:
Ecal2004TBTDCRanges_cff.py:3
EcalTBEventHeader::runNumber
int runNumber() const
Definition:
EcalTBEventHeader.h:37
EcalTBTDCRecInfoAlgo::tdcRanges_
std::vector< EcalTBTDCRanges > tdcRanges_
Definition:
EcalTBTDCRecInfoAlgo.h:29
edm::LogError
Definition:
MessageLogger.h:183
EcalTBTDCRawInfo
Definition:
EcalTBTDCRawInfo.h:13
Ecal2004TBTDCRanges_cff.tdcMax
tdcMax
Definition:
Ecal2004TBTDCRanges_cff.py:4
hcalcalib_dqm_sourceclient-live_cfg.eventType
eventType
Definition:
hcalcalib_dqm_sourceclient-live_cfg.py:205
EcalTBEventHeader::dbEventType
int dbEventType() const
Returns the event type as in the H4ROOTDB.
Definition:
EcalTBEventHeader.cc:53
ecal2004TBWeightUncalibRecHit_cfi.use2004OffsetConvention
use2004OffsetConvention
Definition:
ecal2004TBWeightUncalibRecHit_cfi.py:4
EcalTBTDCRecInfo
Definition:
EcalTBTDCRecInfo.h:12
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition:
hltrates_dqm_sourceclient-live_cfg.py:82
EcalTBTDCRecInfoAlgo::EcalTBTDCRecInfoAlgo
EcalTBTDCRecInfoAlgo()
Definition:
EcalTBTDCRecInfoAlgo.h:12
EcalTBTDCRecInfoAlgo::actualRun_
int actualRun_
Definition:
EcalTBTDCRecInfoAlgo.h:31
EcalTBTDCRecInfoAlgo::actualRange_
int actualRange_
Definition:
EcalTBTDCRecInfoAlgo.h:32
Generated for CMSSW Reference Manual by
1.8.16