CMS 3D CMS Logo

CalibrationScanTask.cc
Go to the documentation of this file.
9 
10 #include <arpa/inet.h>
11 #include <cstdio>
12 #include <fstream>
13 #include <netdb.h>
14 #include <sys/socket.h>
15 #include <sys/unistd.h>
16 
17 // -----------------------------------------------------------------------------
18 //
21  const sistrip::RunType& rtype,
22  const char* filename,
23  uint32_t run,
24  const edm::EventSetup& setup)
25  : CommissioningTask(dqm, conn, "CalibrationScanTask"),
26  runType_(rtype),
27  nBins_(0),
28  lastISHA_(1000),
29  lastVFS_(1000),
30  lastCalChan_(1000),
31  lastCalSel_(1000),
32  lastLatency_(1000),
33  extrainfo_(),
34  run_(run) {
35  // each latency point is 25ns, each calSel is 25/8 --> 64 points = 8 calsel + 8 latency --> as set in the DAQ configuration
37  nBins_ = 64;
38  // each latency point is 25ns, each calSel is 25/8 --> 80 points = 8 calsel + 10 latency --> as set in the DAQ configuration
40  nBins_ = 80;
41 
42  LogDebug("Commissioning") << "[CalibrationScanTask::CalibrationScanTask] Constructing object...";
43  // load the pedestals
44  edm::ESHandle<SiStripPedestals> pedestalsHandle;
45  setup.get<SiStripPedestalsRcd>().get(pedestalsHandle);
46  SiStripPedestals::Range detPedRange = pedestalsHandle->getRange(conn.detId());
47  int start = conn.apvPairNumber() * 256;
48  int stop = start + 256;
49  int value = 0;
50  ped.reserve(256);
51  LogDebug("Commissioning") << "[CalibrationScanTask::CalibrationScanTask] Loading pedestal for " << conn.detId();
52  if (conn.detId() == 0)
53  return;
54  for (int strip = start; strip < stop; ++strip) {
55  value = int(pedestalsHandle->getPed(strip, detPedRange));
56  if (value > 895)
57  value -= 1024;
58  ped.push_back(value);
59  }
60 }
61 
62 // -----------------------------------------------------------------------------
63 //
65  LogDebug("Commissioning") << "[CalibrationScanTask::CalibrationScanTask] Destructing object...";
66 }
67 
68 // -----------------------------------------------------------------------------
69 //
71  if (calib1_.find(extrainfo_) == calib1_.end()) {
72  // construct the histo titles and book two histograms: one per APV --> all strip in one APV are considered to fill histogram
74  runType_,
76  fedKey(),
78  connection().i2cAddr(0),
79  extrainfo_)
80  .title();
81 
85  calib1_[extrainfo_].histo(dqm()->book1D(title, title, nBins_, 0, 200));
87  calib1_[extrainfo_].histo(dqm()->book1D(title, title, nBins_, 0, 250));
88  calib1_[extrainfo_].isProfile_ = false;
89  calib1_[extrainfo_].vNumOfEntries_.resize(nBins_, 0);
90  }
91 
92  if (calib2_.find(extrainfo_) == calib2_.end()) {
94  runType_,
96  fedKey(),
98  connection().i2cAddr(1),
99  extrainfo_)
100  .title();
101 
105  calib2_[extrainfo_].histo(dqm()->book1D(title, title, nBins_, 0, 200));
107  calib2_[extrainfo_].histo(dqm()->book1D(title, title, nBins_, 0, 250));
108  calib2_[extrainfo_].isProfile_ = false;
109  calib2_[extrainfo_].vNumOfEntries_.resize(nBins_, 0);
110  }
111 }
112 
113 // -----------------------------------------------------------------------------
114 //
116  if (lastISHA_ != summary.isha() or
117  lastVFS_ != summary.vfs()) { // triggered only when there is a change in isha and vfs
118  lastISHA_ = summary.isha();
119  lastVFS_ = summary.vfs();
120  lastCalSel_ = summary.calSel();
121  lastLatency_ = summary.latency();
122  lastCalChan_ = summary.calChan();
123  extrainfo_ = "isha_" + std::to_string(lastISHA_) + "_vfs_" + std::to_string(lastVFS_);
124  book(); // book histograms and load the right one
125  } else {
126  lastISHA_ = summary.isha();
127  lastVFS_ = summary.vfs();
128  lastCalSel_ = summary.calSel();
129  lastLatency_ = summary.latency();
130  lastCalChan_ = summary.calChan();
131  extrainfo_ = "isha_" + std::to_string(lastISHA_) + "_vfs_" + std::to_string(lastVFS_);
132  }
133 
134  // retrieve the delay from the EventSummary
135  int bin = 0;
137  bin = (100 - summary.latency()) * 8 + (7 - summary.calSel());
139  bin = (102 - summary.latency()) * 8 + (7 - summary.calSel());
140 
141  // Digis are obtained for an APV pair.strips 0->127 : calib1_ strips 128->255: calib2_
142  // then, only some strips are fired at a time, we use calChan to know that
143  int isub = lastCalChan_ < 4 ? lastCalChan_ + 4 : lastCalChan_ - 4;
144  for (int k = 0; k < 16; ++k) {
145  // all strips of the APV are merged in
147  bin,
148  digis.data[lastCalChan_ + k * 8].adc() - ped[lastCalChan_ + k * 8] -
149  (digis.data[isub + k * 8].adc() - ped[isub + k * 8]));
151  bin,
152  digis.data[128 + lastCalChan_ + k * 8].adc() - ped[128 + lastCalChan_ + k * 8] -
153  (digis.data[128 + isub + k * 8].adc() - ped[128 + isub + k * 8]));
154  }
155  update(); //TODO: temporary: find a better solution later
156 }
157 
158 // -----------------------------------------------------------------------------
159 //
161  LogDebug("Commissioning") << "[CalibrationScanTask::update]"; // huge output
162  for (auto element : calib1_)
163  updateHistoSet(element.second);
164  for (auto element : calib2_)
165  updateHistoSet(element.second);
166 }
167 
sistrip::CALIBRATION_SCAN
Definition: ConstantsForRunType.h:87
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
CalibrationScanTask::directory_
std::string directory_
Definition: CalibrationScanTask.h:33
start
Definition: start.py:1
MessageLogger.h
CalibrationScanTask::CalibrationScanTask
CalibrationScanTask(DQMStore *, const FedChannelConnection &, const sistrip::RunType &, const char *filename, uint32_t run, const edm::EventSetup &setup)
Definition: CalibrationScanTask.cc:19
ESHandle.h
SiStripPedestals::Range
std::pair< ContainerIterator, ContainerIterator > Range
Definition: SiStripPedestals.h:51
edm::DetSet
Definition: DetSet.h:23
CommissioningTask::connection
const FedChannelConnection & connection() const
Definition: CommissioningTask.h:189
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
CalibrationScanTask::ped
std::vector< uint16_t > ped
Definition: CalibrationScanTask.h:31
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
CalibrationScanTask::setCurrentFolder
void setCurrentFolder(const std::string &)
Definition: CalibrationScanTask.cc:168
DQMStore.h
CommissioningTask
Definition: CommissioningTask.h:24
sistrip::RunType
RunType
Definition: ConstantsForRunType.h:70
CalibrationScanTask::nBins_
uint16_t nBins_
Definition: CalibrationScanTask.h:29
SiStripPedestalsRcd
Definition: SiStripCondDataRecords.h:43
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
CommissioningTask::HistoSet
Definition: CommissioningTask.h:38
CommissioningTask::fedKey
const uint32_t & fedKey() const
Definition: CommissioningTask.h:192
CalibrationScanTask::lastCalChan_
uint32_t lastCalChan_
Definition: CalibrationScanTask.h:30
dqm::legacy::DQMStore
Definition: DQMStore.h:727
CalibrationScanTask::~CalibrationScanTask
~CalibrationScanTask() override
Definition: CalibrationScanTask.cc:64
CalibrationScanTask::runType_
sistrip::RunType runType_
Definition: CalibrationScanTask.h:26
sistrip::EXPERT_HISTO
Definition: ConstantsForHistoType.h:29
edm::ESHandle< SiStripPedestals >
SiStripPedestalsRcd.h
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
dqm::implementation::DQMStore::setCurrentFolder
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
dqmdumpme.k
k
Definition: dqmdumpme.py:60
CalibrationScanTask::extrainfo_
std::string extrainfo_
Definition: CalibrationScanTask.h:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
SiStripPedestals::getRange
const Range getRange(const uint32_t &detID) const
Definition: SiStripPedestals.cc:28
FedChannelConnection
Class containning control, module, detector and connection information, at the level of a FED channel...
Definition: FedChannelConnection.h:26
CalibrationScanTask::lastLatency_
uint32_t lastLatency_
Definition: CalibrationScanTask.h:30
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
CalibrationScanTask::lastVFS_
uint32_t lastVFS_
Definition: CalibrationScanTask.h:30
sistrip::APV
Definition: ConstantsForGranularity.h:79
createfilelist.int
int
Definition: createfilelist.py:10
edmLumisInFiles.summary
summary
Definition: edmLumisInFiles.py:39
CalibrationScanTask::calib2_
std::map< std::string, HistoSet > calib2_
Definition: CalibrationScanTask.h:27
CommissioningTask::updateHistoSet
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
Definition: CommissioningTask.cc:274
value
Definition: value.py:1
edm::EventSetup
Definition: EventSetup.h:57
get
#define get
CalibrationScanTask::fill
void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) override
Definition: CalibrationScanTask.cc:115
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
sistrip::CALIBRATION_SCAN_DECO
Definition: ConstantsForRunType.h:88
CalibrationScanTask::lastCalSel_
uint32_t lastCalSel_
Definition: CalibrationScanTask.h:30
writedatasetfile.run
run
Definition: writedatasetfile.py:27
CommissioningTask::dqm
DQMStore *const dqm() const
Definition: CommissioningTask.h:188
CalibrationScanTask::calib1_
std::map< std::string, HistoSet > calib1_
Definition: CalibrationScanTask.h:27
CalibrationScanTask::book
void book() override
Definition: CalibrationScanTask.cc:70
SiStripHistoTitle.h
SiStripPedestals.h
SiStripHistoTitle::title
const std::string & title() const
Definition: SiStripHistoTitle.h:109
edm::DetSet::data
collection_type data
Definition: DetSet.h:80
EventSetup.h
SiStripHistoTitle
Utility class that holds histogram title.
Definition: SiStripHistoTitle.h:20
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
CalibrationScanTask::lastISHA_
uint32_t lastISHA_
Definition: CalibrationScanTask.h:30
CalibrationScanTask::update
void update() override
Definition: CalibrationScanTask.cc:160
dqm
Definition: DQMStore.h:18
SiStripPedestals::getPed
float getPed(const uint16_t &strip, const Range &range) const
Definition: SiStripPedestals.cc:51
sistrip::FED_KEY
Definition: ConstantsForKeyType.h:30
SiStripEventSummary
Definition: SiStripEventSummary.h:22
CalibrationScanTask.h
DeadROC_duringRun.dir
dir
Definition: DeadROC_duringRun.py:23