CMS 3D CMS Logo

FineDelayTask.cc
Go to the documentation of this file.
6 
7 #define NBINS (500)
8 #define LOWBIN (-125)
9 #define HIGHBIN (125)
10 
11 // -----------------------------------------------------------------------------
12 //
15 
16 // -----------------------------------------------------------------------------
17 //
19  : CommissioningTask(dqm, conn, "FineDelayTask") {
20  LogDebug("Commissioning") << "[FineDelayTask::FineDelayTask] Constructing object...";
21 }
22 
23 // -----------------------------------------------------------------------------
24 //
25 FineDelayTask::~FineDelayTask() { LogDebug("Commissioning") << "[FineDelayTask::FineDelayTask] Destructing object..."; }
26 
27 // -----------------------------------------------------------------------------
28 //
30  LogDebug("Commissioning") << "[FineDelayTask::book]";
31 
33  int nBins = NBINS;
34  SiStripDetKey detkeytracker((uint32_t)0);
35 
36  // see if the global timing histogram is already booked
37  if (timing_.histo()) {
38  // if already booked, use it
39  LogDebug("Commissioning") << "[FineDelayTask::book] using existing histogram.";
40  } else {
41  // make a new histo on the tracker level if not existing yet
42  LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram.";
43  // construct the histo title
47  detkeytracker.key(),
49  0,
51  .title();
52  dqm()->setCurrentFolder(detkeytracker.path());
53  timing_.histo(dqm()->bookProfile(title,
54  title, // name and title
55  nBins,
56  LOWBIN,
57  HIGHBIN, // binning + range
58  100,
59  0.,
60  -1.,
61  "s")); // Y range : automatic
62  timing_.vNumOfEntries_.resize(nBins, 0);
63  timing_.vSumOfContents_.resize(nBins, 0);
64  timing_.vSumOfSquares_.resize(nBins, 0);
65  }
66  LogDebug("Commissioning") << "Binning is " << timing_.vNumOfEntries_.size();
67  LogDebug("Commissioning") << "[FineDelayTask::book] done";
68  if (!mode_) {
69  std::string pwd = dqm()->pwd();
70  std::string rootDir = pwd.substr(0, pwd.find(std::string(sistrip::root_) + "/") + (sizeof(sistrip::root_)));
71  dqm()->setCurrentFolder(rootDir);
72  mode_ = dqm()->bookInt("latencyCode");
73  }
74 }
75 
76 // -----------------------------------------------------------------------------
77 //
79  LogDebug("Commissioning") << "[FineDelayTask::fill]";
80  // retrieve the delay from the EventSummary
81  float delay = summary.ttcrx();
82  uint32_t latencyCode = (summary.layerScanned() >> 24) & 0xff;
83  LogDebug("Commissioning") << "[FineDelayTask::fill]: layerScanned() is " << summary.layerScanned();
84  int latencyShift =
85  latencyCode & 0x3f; // number of bunch crossings between current value and start of scan... must be positive
86  if (latencyShift > 32)
87  latencyShift -= 64; // allow negative values: we cover [-32,32].. should not be needed.
88  if ((latencyCode >> 6) == 2)
89  latencyShift -= 3; // layer in deconv, rest in peak
90  if ((latencyCode >> 6) == 1)
91  latencyShift += 3; // layer in peak, rest in deconv
92  float correctedDelay =
93  delay - (latencyShift * 25.); // shifts the delay so that 0 corresponds to the current settings.
94 
95  LogDebug("Commissioning") << "[FineDelayTask::fill]; the delay is " << delay;
96  // loop on the strips to find the (maybe) non-zero digi
97  for (unsigned int strip = 0; strip < digis.data.size(); strip++) {
98  if (digis.data[strip].adc() != 0) {
99  // apply the TOF correction
100  float tof = (digis.data[strip].adc() >> 8) / 10.;
101  correctedDelay = delay - (latencyShift * 25.) - tof;
102  if ((digis.data[strip].adc() >> 8) == 255)
103  continue; // skip hit if TOF is in overflow
104  // compute the bin
105  float nbins = NBINS;
106  float lowbin = LOWBIN;
107  float highbin = HIGHBIN;
108  int bin = int((correctedDelay - lowbin) / ((highbin - lowbin) / nbins));
109  LogDebug("Commissioning") << "[FineDelayTask::fill]; using a hit with value " << (digis.data[strip].adc() & 0xff)
110  << " at corrected delay of " << correctedDelay << " in bin " << bin << " (tof is "
111  << tof << "( since adc = " << digis.data[strip].adc() << "))";
112  updateHistoSet(timing_, bin, digis.data[strip].adc() & 0xff);
113  if (mode_)
114  mode_->Fill(latencyCode);
115  }
116  }
117 }
118 
119 // -----------------------------------------------------------------------------
120 //
122  LogDebug("Commissioning") << "[FineDelayTask::update]";
124 }
CommissioningTask::HistoSet::vSumOfSquares_
std::vector< double > vSumOfSquares_
Definition: CommissioningTask.h:46
FineDelayTask::update
void update() override
Definition: FineDelayTask.cc:121
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
NBINS
#define NBINS
Definition: FineDelayTask.cc:7
MessageLogger.h
CommissioningTask::HistoSet::vSumOfContents_
std::vector< float > vSumOfContents_
Definition: CommissioningTask.h:45
sistrip::TRACKER
Definition: ConstantsForGranularity.h:64
alignCSCRings.pwd
pwd
Definition: alignCSCRings.py:57
edm::DetSet
Definition: DetSet.h:23
sistrip::DET_KEY
Definition: ConstantsForKeyType.h:32
SiStripKey::key
const uint32_t & key() const
Definition: SiStripKey.h:120
digitizers_cfi.strip
strip
Definition: digitizers_cfi.py:19
SiStripCommissioningClient_cfg.conn
conn
Definition: SiStripCommissioningClient_cfg.py:5
DQMStore.h
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
CommissioningTask
Definition: CommissioningTask.h:24
CommissioningTask::HistoSet
Definition: CommissioningTask.h:38
CommissioningTask::HistoSet::vNumOfEntries_
std::vector< float > vNumOfEntries_
Definition: CommissioningTask.h:44
sistrip::FINE_DELAY
Definition: ConstantsForRunType.h:85
dqm::legacy::DQMStore
Definition: DQMStore.h:727
sistrip::extrainfo::clusterCharge_
static const char clusterCharge_[]
Definition: ConstantsForDqm.h:59
dqm::impl::MonitorElement::Fill
void Fill(long long x)
Definition: MonitorElement.h:290
sistrip::EXPERT_HISTO
Definition: ConstantsForHistoType.h:29
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
dqm::implementation::DQMStore::setCurrentFolder
void setCurrentFolder(std::string const &fullpath) override
Definition: DQMStore.h:569
seedmultiplicitymonitor_newtracking_cfi.nBins
nBins
Definition: seedmultiplicitymonitor_newtracking_cfi.py:8
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HIGHBIN
#define HIGHBIN
Definition: FineDelayTask.cc:9
FedChannelConnection
Class containning control, module, detector and connection information, at the level of a FED channel...
Definition: FedChannelConnection.h:26
dqm::implementation::DQMStore::pwd
std::string pwd() override
Definition: DQMStore.h:567
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:233
CommissioningTask::HistoSet::histo
void histo(MonitorElement *)
Definition: CommissioningTask.cc:89
SiStripKey::path
const std::string & path() const
Definition: SiStripKey.h:121
FineDelayTask::fill
void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) override
Definition: FineDelayTask.cc:78
FineDelayTask::FineDelayTask
FineDelayTask(DQMStore *, const FedChannelConnection &)
Definition: FineDelayTask.cc:18
FineDelayTask::book
void book() override
Definition: FineDelayTask.cc:29
dqm::implementation::IBooker::bookInt
MonitorElement * bookInt(TString const &name, FUNC onbooking=NOOP())
Definition: DQMStore.h:73
createfilelist.int
int
Definition: createfilelist.py:10
edmLumisInFiles.summary
summary
Definition: edmLumisInFiles.py:39
CommissioningTask::updateHistoSet
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
Definition: CommissioningTask.cc:274
sistrip::root_
static const char root_[]
Definition: ConstantsForDqm.h:30
FineDelayTask.h
SiStripDetKey.h
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
SiStripDetKey
Utility class that identifies a position within the strip tracker geometrical structure,...
Definition: SiStripDetKey.h:28
CommissioningTask::dqm
DQMStore *const dqm() const
Definition: CommissioningTask.h:188
SiStripHistoTitle.h
edm::DetSet::data
collection_type data
Definition: DetSet.h:80
FineDelayTask::~FineDelayTask
~FineDelayTask() override
Definition: FineDelayTask.cc:25
SiStripHistoTitle
Utility class that holds histogram title.
Definition: SiStripHistoTitle.h:20
FineDelayTask::timing_
static HistoSet timing_
Definition: FineDelayTask.h:21
LOWBIN
#define LOWBIN
Definition: FineDelayTask.cc:8
FineDelayTask::mode_
static MonitorElement * mode_
Definition: FineDelayTask.h:22
phase2TrackerDigitizer_cfi.delay
delay
Definition: phase2TrackerDigitizer_cfi.py:49
dqm
Definition: DQMStore.h:18
SiStripEventSummary
Definition: SiStripEventSummary.h:22