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 }
#define LogDebug(id)
std::vector< float > vNumOfEntries_
#define HIGHBIN
Definition: FineDelayTask.cc:9
Utility class that holds histogram title.
const uint32_t & layerScanned() const
std::vector< float > vSumOfContents_
std::string const & pwd() const
Definition: DQMStore.cc:618
MonitorElement * bookInt(char_string const &name)
Book int.
Definition: DQMStore.cc:1072
void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &) override
FineDelayTask(DQMStore *, const FedChannelConnection &)
const uint32_t & key() const
Definition: SiStripKey.h:120
void Fill(long long x)
#define LOWBIN
Definition: FineDelayTask.cc:8
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
DQMStore *const dqm() const
Class containning control, module, detector and connection information, at the level of a FED channel...
void book() override
const std::string & path() const
Definition: SiStripKey.h:121
void update() override
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
Definition: SiStripDetKey.h:28
static const char clusterCharge_[]
~FineDelayTask() override
#define NBINS
Definition: FineDelayTask.cc:7
static MonitorElement * mode_
Definition: FineDelayTask.h:22
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:639
collection_type data
Definition: DetSet.h:81
void histo(MonitorElement *)
static const char root_[]
std::vector< double > vSumOfSquares_
const uint32_t & ttcrx() const
static HistoSet timing_
Definition: FineDelayTask.h:21