CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FineDelayTask.cc
Go to the documentation of this file.
7 
8 #define NBINS (500)
9 #define LOWBIN (-125)
10 #define HIGHBIN (125)
11 
12 
13 // -----------------------------------------------------------------------------
14 //
17 
18 // -----------------------------------------------------------------------------
19 //
21  const FedChannelConnection& conn ) :
22  CommissioningTask( dqm, conn, "FineDelayTask" )
23 {
24  LogDebug("Commissioning") << "[FineDelayTask::FineDelayTask] Constructing object...";
25 }
26 
27 // -----------------------------------------------------------------------------
28 //
30  LogDebug("Commissioning") << "[FineDelayTask::FineDelayTask] Destructing object...";
31 }
32 
33 // -----------------------------------------------------------------------------
34 //
36  LogDebug("Commissioning") << "[FineDelayTask::book]";
37 
39  int nBins = NBINS;
40  SiStripDetKey detkeytracker((uint32_t) 0);
41 
42  // see if the global timing histogram is already booked
43  if (timing_.histo()) {
44  // if already booked, use it
45  LogDebug("Commissioning") << "[FineDelayTask::book] using existing histogram.";
46  } else {
47  // make a new histo on the tracker level if not existing yet
48  LogDebug("Commissioning") << "[LatencyTask::book] booking a new histogram.";
49  // construct the histo title
53  detkeytracker.key(),
55  0,
57  dqm()->setCurrentFolder( detkeytracker.path() );
58  timing_.histo( dqm()->bookProfile( title, title, // name and title
59  nBins, LOWBIN, HIGHBIN, // binning + range
60  100, 0., -1., "s" ) ); // Y range : automatic
61  timing_.vNumOfEntries_.resize(nBins,0);
62  timing_.vSumOfContents_.resize(nBins,0);
63  timing_.vSumOfSquares_.resize(nBins,0);
64  }
65  LogDebug("Commissioning") << "Binning is " << timing_.vNumOfEntries_.size();
66  LogDebug("Commissioning") << "[FineDelayTask::book] done";
67  if(!mode_) {
68  std::string pwd = dqm()->pwd();
69  std::string rootDir = pwd.substr(0,pwd.find(std::string(sistrip::root_) + "/")+(sizeof(sistrip::root_)));
70  dqm()->setCurrentFolder( rootDir );
71  mode_ = dqm()->bookInt("latencyCode");
72  }
73 
74 }
75 
76 // -----------------------------------------------------------------------------
77 //
79  const edm::DetSet<SiStripRawDigi>& digis ) {
80  LogDebug("Commissioning") << "[FineDelayTask::fill]";
81  // retrieve the delay from the EventSummary
82  float delay = const_cast<SiStripEventSummary&>(summary).ttcrx();
83  uint32_t latencyCode = (const_cast<SiStripEventSummary&>(summary).layerScanned()>>24)&0xff;
84  LogDebug("Commissioning") << "[FineDelayTask::fill]: layerScanned() is " << const_cast<SiStripEventSummary&>(summary).layerScanned();
85  int latencyShift = latencyCode & 0x3f; // number of bunch crossings between current value and start of scan... must be positive
86  if(latencyShift>32) latencyShift -=64; // allow negative values: we cover [-32,32].. should not be needed.
87  if((latencyCode>>6)==2) latencyShift -= 3; // layer in deconv, rest in peak
88  if((latencyCode>>6)==1) latencyShift += 3; // layer in peak, rest in deconv
89  float correctedDelay = delay - (latencyShift*25.); // shifts the delay so that 0 corresponds to the current settings.
90 
91  LogDebug("Commissioning") << "[FineDelayTask::fill]; the delay is " << delay;
92  // loop on the strips to find the (maybe) non-zero digi
93  for(unsigned int strip=0;strip<digis.data.size();strip++) {
94  if(digis.data[strip].adc()!=0) {
95  // apply the TOF correction
96  float tof = (digis.data[strip].adc()>>8)/10.;
97  correctedDelay = delay - (latencyShift*25.) - tof;
98  if((digis.data[strip].adc()>>8)==255) continue; // skip hit if TOF is in overflow
99  // compute the bin
100  float nbins = NBINS;
101  float lowbin = LOWBIN;
102  float highbin = HIGHBIN;
103  int bin = int((correctedDelay-lowbin)/((highbin-lowbin)/nbins));
104  LogDebug("Commissioning") << "[FineDelayTask::fill]; using a hit with value " << ( digis.data[strip].adc()&0xff )
105  << " at corrected delay of " << correctedDelay
106  << " in bin " << bin << " (tof is " << tof << "( since adc = " << digis.data[strip].adc() << "))";
107  updateHistoSet( timing_,bin,digis.data[strip].adc()&0xff);
108  if(mode_) mode_->Fill(latencyCode);
109  }
110  }
111 }
112 
113 // -----------------------------------------------------------------------------
114 //
116  LogDebug("Commissioning") << "[FineDelayTask::update]";
118 }
119 
#define LogDebug(id)
std::vector< float > vNumOfEntries_
#define HIGHBIN
Utility class that holds histogram title.
virtual void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &)
std::vector< float > vSumOfContents_
#define NULL
Definition: scimark2.h:8
FineDelayTask(DQMStore *, const FedChannelConnection &)
void Fill(long long x)
const uint32_t & key() const
Definition: SiStripKey.h:126
#define LOWBIN
Definition: FineDelayTask.cc:9
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
Class containning control, module, detector and connection information, at the level of a FED channel...
virtual ~FineDelayTask()
const std::string & path() const
Definition: SiStripKey.h:127
Utility class that identifies a position within the strip tracker geometrical structure, down to the level of an APV25 chip.
Definition: SiStripDetKey.h:29
static const char clusterCharge_[]
DQMStore *const dqm() const
virtual void update()
#define NBINS
Definition: FineDelayTask.cc:8
collection_type data
Definition: DetSet.h:79
void histo(MonitorElement *)
static const char root_[]
virtual void book()
std::vector< double > vSumOfSquares_
static MonitorElement * mode_
Definition: FineDelayTask.h:26
MonitorElement * bookInt(const char *name)
Book int.
Definition: DQMStore.cc:629
tuple conn
Definition: results_mgr.py:53
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
static HistoSet timing_
Definition: FineDelayTask.h:25
const std::string & pwd(void) const
Definition: DQMStore.cc:406