1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#include "EventFilter/EcalRawToDigi/interface/DCCEBSRPBlock.h"
#include "EventFilter/EcalRawToDigi/interface/DCCDataBlockPrototype.h"
#include "EventFilter/EcalRawToDigi/interface/DCCEventBlock.h"
#include "EventFilter/EcalRawToDigi/interface/DCCDataUnpacker.h"
#include "EventFilter/EcalRawToDigi/interface/EcalElectronicsMapper.h"
DCCEBSRPBlock::DCCEBSRPBlock(DCCDataUnpacker *u, EcalElectronicsMapper *m, DCCEventBlock *e, bool unpack)
: DCCSRPBlock(u, m, e, unpack) {
expNumbSrFlags_ = SRP_EB_NUMBFLAGS;
}
void DCCEBSRPBlock::updateCollectors() {
// Set SR flag digis
ebSrFlagsDigis_ = unpacker_->ebSrFlagsCollection();
}
void DCCEBSRPBlock::addSRFlagToCollection() {
// Point to SR flags
data_++;
const uint16_t *my16Bitp_ = reinterpret_cast<const uint16_t *>(data_);
unsigned int towersInPhi = EcalElectronicsMapper::kTowersInPhi;
unsigned int fov = event_->fov();
for (unsigned int n = 0; n < expNumbSrFlags_; n++) {
if (n > 0 && n % 4 == 0)
my16Bitp_++;
unsigned short srFlag = (*my16Bitp_ >> ((n - (n / 4) * 4) * 3)) & SRP_SRFLAG_MASK;
unsigned int theSRPi = n;
if (NUMB_SM_EB_PLU_MIN <= mapper_->getActiveSM() && mapper_->getActiveSM() <= NUMB_SM_EB_PLU_MAX && fov >= 1) {
unsigned int u = n % towersInPhi;
u = towersInPhi - u;
theSRPi = (n / towersInPhi) * towersInPhi + u - 1;
}
srFlags_[theSRPi] = srFlag;
if (unpackInternalData_) {
std::vector<EcalSrFlag *> srs = mapper_->getSrFlagPointer(theSRPi + 1);
for (size_t i = 0; i < srs.size(); ++i) {
srs[i]->setValue(srFlag);
(*ebSrFlagsDigis_)->push_back(*((EBSrFlag *)srs[i]));
}
}
}
}
bool DCCEBSRPBlock::checkSrpIdAndNumbSRFlags() {
//todo : check srp id based on sm...
// Check number of SR flags
if (nSRFlags_ != expNumbSrFlags_) {
if (!DCCDataUnpacker::silentMode_) {
edm::LogWarning("IncorrectBlock") << "Unable to unpack SRP block for event " << event_->l1A() << " in fed <<"
<< mapper_->getActiveDCC() << "\nNumber of flags " << nSRFlags_
<< " is different from expected " << expNumbSrFlags_;
}
//Note : add to error collection ?
return false;
}
return true;
}
|