CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTT0Calibration.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2012/05/11 17:17:17 $
5  * $Revision: 1.13 $
6  * \author S. Bolognesi - INFN Torino
7  */
10 
13 
16 
19 
20 #include "TH1I.h"
21 #include "TFile.h"
22 #include "TKey.h"
23 
24 using namespace std;
25 using namespace edm;
26 // using namespace cond;
27 
28 // Constructor
30  // Get the debug parameter for verbose output
31  debug = pset.getUntrackedParameter<bool>("debug");
32  if(debug)
33  cout << "[DTT0Calibration]Constructor called!" << endl;
34 
35  // Get the label to retrieve digis from the event
36  digiLabel = pset.getUntrackedParameter<string>("digiLabel");
37 
38  // The root file which contain the histos per layer
39  string rootFileName = pset.getUntrackedParameter<string>("rootFileName","DTT0PerLayer.root");
40  theFile = new TFile(rootFileName.c_str(), "RECREATE");
41 
42  theCalibWheel = pset.getUntrackedParameter<string>("calibWheel", "All"); //FIXME amke a vector of integer instead of a string
43  if(theCalibWheel != "All") {
44  stringstream linestr;
45  int selWheel;
46  linestr << theCalibWheel;
47  linestr >> selWheel;
48  cout << "[DTT0CalibrationPerLayer] chosen wheel " << selWheel << endl;
49  }
50 
51  // Sector/s to calibrate
52  theCalibSector = pset.getUntrackedParameter<string>("calibSector", "All"); //FIXME amke a vector of integer instead of a string
53  if(theCalibSector != "All") {
54  stringstream linestr;
55  int selSector;
56  linestr << theCalibSector;
57  linestr >> selSector;
58  cout << "[DTT0CalibrationPerLayer] chosen sector " << selSector << endl;
59  }
60 
61  vector<string> defaultCell;
62  defaultCell.push_back("None");
63  cellsWithHistos = pset.getUntrackedParameter<vector<string> >("cellsWithHisto", defaultCell);
64  for(vector<string>::const_iterator cell = cellsWithHistos.begin(); cell != cellsWithHistos.end(); cell++){
65  if((*cell) != "None"){
66  stringstream linestr;
67  int wheel,sector,station,sl,layer,wire;
68  linestr << (*cell);
69  linestr >> wheel >> sector >> station >> sl >> layer >> wire;
70  wireIdWithHistos.push_back(DTWireId(wheel,station,sector,sl,layer,wire));
71  }
72  }
73 
74  hT0SectorHisto=0;
75 
76  nevents=0;
77  eventsForLayerT0 = pset.getParameter<unsigned int>("eventsForLayerT0");
78  eventsForWireT0 = pset.getParameter<unsigned int>("eventsForWireT0");
79  rejectDigiFromPeak = pset.getParameter<unsigned int>("rejectDigiFromPeak");
80  tpPeakWidth = pset.getParameter<double>("tpPeakWidth");
81  //useReferenceWireInLayer_ = true;
82  correctByChamberMean_ = pset.getParameter<bool>("correctByChamberMean");
83 }
84 
85 // Destructor
87  if(debug)
88  cout << "[DTT0Calibration]Destructor called!" << endl;
89 
90  theFile->Close();
91 }
92 
94 void DTT0Calibration::analyze(const edm::Event & event, const edm::EventSetup& eventSetup) {
95  if(debug || event.id().event() % 500==0)
96  cout << "--- [DTT0Calibration] Analysing Event: #Run: " << event.id().run()
97  << " #Event: " << event.id().event() << endl;
98  nevents++;
99 
100  // Get the digis from the event
102  event.getByLabel(digiLabel, digis);
103 
104  // Get the DT Geometry
105  eventSetup.get<MuonGeometryRecord>().get(dtGeom);
106 
107  // Iterate through all digi collections ordered by LayerId
109  for (dtLayerIt = digis->begin();
110  dtLayerIt != digis->end();
111  ++dtLayerIt){
112  // Get the iterators over the digis associated with this LayerId
113  const DTDigiCollection::Range& digiRange = (*dtLayerIt).second;
114 
115  // Get the layerId
116  const DTLayerId layerId = (*dtLayerIt).first; //FIXME: check to be in the right sector
117 
118  if((theCalibWheel != "All") && (layerId.superlayerId().chamberId().wheel() != selWheel))
119  continue;
120  if((theCalibSector != "All") && (layerId.superlayerId().chamberId().sector() != selSector))
121  continue;
122 
123  //if(debug) {
124  // cout << "Layer " << layerId<<" with "<<distance(digiRange.first, digiRange.second)<<" digi"<<endl;
125  //}
126 
127  // Loop over all digis in the given layer
128  for (DTDigiCollection::const_iterator digi = digiRange.first;
129  digi != digiRange.second;
130  digi++) {
131  double t0 = (*digi).countsTDC();
132 
133  //Use first bunch of events to fill t0 per layer
134  if(nevents < eventsForLayerT0){
135  //Get the per-layer histo from the map
136  TH1I *hT0LayerHisto = theHistoLayerMap[layerId];
137  //If it doesn't exist, book it
138  if(hT0LayerHisto == 0){
139  theFile->cd();
140  hT0LayerHisto = new TH1I(getHistoName(layerId).c_str(),
141  "T0 from pulses by layer (TDC counts, 1 TDC count = 0.781 ns)",
142  200, t0-100, t0+100);
143  if(debug)
144  cout << " New T0 per Layer Histo: " << hT0LayerHisto->GetName() << endl;
145  theHistoLayerMap[layerId] = hT0LayerHisto;
146  }
147 
148  //Fill the histos
149  theFile->cd();
150  if(hT0LayerHisto != 0) {
151  // if(debug)
152  // cout<<"Filling histo "<<hT0LayerHisto->GetName()<<" with digi "<<t0<<" TDC counts"<<endl;
153  hT0LayerHisto->Fill(t0);
154  }
155  }
156 
157  //Use all the remaining events to compute t0 per wire
158  if(nevents>eventsForLayerT0){
159  // Get the wireId
160  const DTWireId wireId(layerId, (*digi).wire());
161  if(debug) {
162  cout << " Wire: " << wireId << endl
163  << " time (TDC counts): " << (*digi).countsTDC()<< endl;
164  }
165 
166  //Fill the histos per wire for the chosen cells
167  vector<DTWireId>::iterator it_wire = find(wireIdWithHistos.begin(),wireIdWithHistos.end(),wireId);
168  if(it_wire != wireIdWithHistos.end()){
169  if(theHistoWireMap.find(wireId) == theHistoWireMap.end()){
170  theHistoWireMap[wireId] = new TH1I(getHistoName(wireId).c_str(),"T0 from pulses by wire (TDC counts, 1 TDC count = 0.781 ns)",7000,0,7000);
171  if(debug) cout << " New T0 per wire Histo: " << (theHistoWireMap[wireId])->GetName() << endl;
172  }
173  if(theHistoWireMap_ref.find(wireId) == theHistoWireMap_ref.end()){
174  theHistoWireMap_ref[wireId] = new TH1I((getHistoName(wireId) + "_ref").c_str(),"T0 from pulses by wire (TDC counts, 1 TDC count = 0.781 ns)",7000,0,7000);
175  if(debug) cout << " New T0 per wire Histo: " << (theHistoWireMap_ref[wireId])->GetName() << endl;
176  }
177 
178  TH1I* hT0WireHisto = theHistoWireMap[wireId];
179  //Fill the histos
180  theFile->cd();
181  if(hT0WireHisto) hT0WireHisto->Fill(t0);
182  }
183 
184  //Check the tzero has reasonable value
185  if(abs(hT0SectorHisto->GetBinCenter(hT0SectorHisto->GetMaximumBin()) - t0) > rejectDigiFromPeak){
186  if(debug)
187  cout<<"digi skipped because t0 per sector "<<hT0SectorHisto->GetBinCenter(hT0SectorHisto->GetMaximumBin())<<endl;
188  continue;
189  }
190 
191  //Use second bunch of events to compute a t0 reference per wire
192  if(nevents< (eventsForLayerT0 + eventsForWireT0)){
193  //Fill reference wire histos
194  if(it_wire != wireIdWithHistos.end()){
195  TH1I* hT0WireHisto_ref = theHistoWireMap_ref[wireId];
196  theFile->cd();
197  if(hT0WireHisto_ref) hT0WireHisto_ref->Fill(t0);
198  }
199  if(!nDigiPerWire_ref[wireId]){
200  mK_ref[wireId] = 0;
201  }
202  nDigiPerWire_ref[wireId] = nDigiPerWire_ref[wireId] + 1;
203  mK_ref[wireId] = mK_ref[wireId] + (t0-mK_ref[wireId])/nDigiPerWire_ref[wireId];
204  }
205  //Use last all the remaining events to compute the mean and sigma t0 per wire
206  else if(nevents>(eventsForLayerT0 + eventsForWireT0)){
207  if(abs(t0-mK_ref[wireId]) > tpPeakWidth)
208  continue;
209  if(!nDigiPerWire[wireId]){
210  theAbsoluteT0PerWire[wireId] = 0;
211  qK[wireId] = 0;
212  mK[wireId] = 0;
213  }
214  nDigiPerWire[wireId] = nDigiPerWire[wireId] + 1;
215  theAbsoluteT0PerWire[wireId] = theAbsoluteT0PerWire[wireId] + t0;
216  //theSigmaT0PerWire[wireId] = theSigmaT0PerWire[wireId] + (t0*t0);
217  qK[wireId] = qK[wireId] + ((nDigiPerWire[wireId]-1)*(t0-mK[wireId])*(t0-mK[wireId])/nDigiPerWire[wireId]);
218  mK[wireId] = mK[wireId] + (t0-mK[wireId])/nDigiPerWire[wireId];
219  }
220  }//end if(nevents>1000)
221  }//end loop on digi
222  }//end loop on layer
223 
224  //Use the t0 per layer histos to have an indication about the t0 position
225  if(nevents == eventsForLayerT0){
226  for(map<DTLayerId, TH1I*>::const_iterator lHisto = theHistoLayerMap.begin();
227  lHisto != theHistoLayerMap.end();
228  lHisto++){
229  if(debug)
230  cout<<"Reading histogram "<<(*lHisto).second->GetName()<<" with mean "<<(*lHisto).second->GetMean()<<" and RMS "<<(*lHisto).second->GetRMS();
231 
232  //Take the mean as a first t0 estimation
233  if((*lHisto).second->GetRMS()<5.0){
234  if(hT0SectorHisto == 0){
235  hT0SectorHisto = new TH1D("hT0AllLayerOfSector","T0 from pulses per layer in sector",
236  //20, (*lHisto).second->GetMean()-100, (*lHisto).second->GetMean()+100);
237  700, 0, 7000);
238  }
239  if(debug)
240  cout<<" accepted"<<endl;
241  hT0SectorHisto->Fill((*lHisto).second->GetMean());
242  }
243  //Take the mean of noise + 400ns as a first t0 estimation
244  // if((*lHisto).second->GetRMS()>10.0 && ((*lHisto).second->GetRMS()<15.0)){
245 // double t0_estim = (*lHisto).second->GetMean() + 400;
246 // if(hT0SectorHisto == 0){
247 // hT0SectorHisto = new TH1D("hT0AllLayerOfSector","T0 from pulses per layer in sector",
248 // //20, t0_estim-100, t0_estim+100);
249 // 700, 0, 7000);
250 // }
251 // if(debug)
252 // cout<<" accepted + 400ns"<<endl;
253 // hT0SectorHisto->Fill((*lHisto).second->GetMean() + 400);
254 // }
255  if(debug)
256  cout<<endl;
257 
258  theT0LayerMap[(*lHisto).second->GetName()] = (*lHisto).second->GetMean();
259  theSigmaT0LayerMap[(*lHisto).second->GetName()] = (*lHisto).second->GetRMS();
260  }
261  if(!hT0SectorHisto){
262  cout<<"[DTT0Calibration]: All the t0 per layer are still uncorrect: trying with greater number of events"<<endl;
263  eventsForLayerT0 = eventsForLayerT0*2;
264  return;
265  }
266  if(debug)
267  cout<<"[DTT0Calibration] t0 reference for this sector "<<
268  hT0SectorHisto->GetBinCenter(hT0SectorHisto->GetMaximumBin())<<endl;
269  }
270 }
271 
272 
274 
275  DTT0* t0sAbsolute = new DTT0();
276  DTT0* t0sRelative = new DTT0();
277  DTT0* t0sWRTChamber = new DTT0();
278 
279  //if(debug)
280  cout << "[DTT0CalibrationPerLayer]Writing histos to file!" << endl;
281 
282  theFile->cd();
283  hT0SectorHisto->Write();
284  for(map<DTWireId, TH1I*>::const_iterator wHisto = theHistoWireMap.begin();
285  wHisto != theHistoWireMap.end();
286  wHisto++) {
287  (*wHisto).second->Write();
288  }
289  for(map<DTWireId, TH1I*>::const_iterator wHisto = theHistoWireMap_ref.begin();
290  wHisto != theHistoWireMap_ref.end();
291  wHisto++) {
292  (*wHisto).second->Write();
293  }
294  for(map<DTLayerId, TH1I*>::const_iterator lHisto = theHistoLayerMap.begin();
295  lHisto != theHistoLayerMap.end();
296  lHisto++) {
297  (*lHisto).second->Write();
298  }
299 
300  //if(debug)
301  cout << "[DTT0Calibration] Compute and store t0 and sigma per wire" << endl;
302 
303  for(map<DTWireId, double>::const_iterator wiret0 = theAbsoluteT0PerWire.begin();
304  wiret0 != theAbsoluteT0PerWire.end();
305  wiret0++){
306  if(nDigiPerWire[(*wiret0).first]){
307  double t0 = (*wiret0).second/nDigiPerWire[(*wiret0).first];
308 
309  theRelativeT0PerWire[(*wiret0).first] = t0 - hT0SectorHisto->GetBinCenter(hT0SectorHisto->GetMaximumBin());
310 
311  //theSigmaT0PerWire[(*wiret0).first] = sqrt((theSigmaT0PerWire[(*wiret0).first] / nDigiPerWire[(*wiret0).first]) - t0*t0);
312  theSigmaT0PerWire[(*wiret0).first] = sqrt(qK[(*wiret0).first]/nDigiPerWire[(*wiret0).first]);
313 
314  cout << "Wire " << (*wiret0).first << " has t0 " << t0 << "(absolute) "
315  << theRelativeT0PerWire[(*wiret0).first] << "(relative)"
316  << " sigma " << theSigmaT0PerWire[(*wiret0).first] << endl;
317 
318  t0sAbsolute->set((*wiret0).first, t0, theSigmaT0PerWire[(*wiret0).first],DTTimeUnits::counts);
319  }
320  else{
321  cout<<"[DTT0Calibration] ERROR: no digis in wire "<<(*wiret0).first<<endl;
322  abort();
323  }
324  }
325 
326  if(correctByChamberMean_){
328  // Get all the sls from the setup
329  const vector<DTSuperLayer*> superLayers = dtGeom->superLayers();
330  // Loop over all SLs
331  for(vector<DTSuperLayer*>::const_iterator sl = superLayers.begin();
332  sl != superLayers.end(); sl++) {
333 
334 
335  //Compute mean for odd and even superlayers
336  double oddLayersMean=0;
337  double evenLayersMean=0;
338  double oddLayersDen=0;
339  double evenLayersDen=0;
340  for(map<DTWireId, double>::const_iterator wiret0 = theRelativeT0PerWire.begin();
341  wiret0 != theRelativeT0PerWire.end();
342  wiret0++){
343  if((*wiret0).first.layerId().superlayerId() == (*sl)->id()){
344  if(debug)
345  cout<<"[DTT0Calibration] Superlayer "<<(*sl)->id()
346  <<"layer " <<(*wiret0).first.layerId().layer()<<" with "<<(*wiret0).second<<endl;
347  if(((*wiret0).first.layerId().layer()) % 2){
348  oddLayersMean = oddLayersMean + (*wiret0).second;
349  oddLayersDen++;
350  }
351  else{
352  evenLayersMean = evenLayersMean + (*wiret0).second;
353  evenLayersDen++;
354  }
355  }
356  }
357  oddLayersMean = oddLayersMean/oddLayersDen;
358  evenLayersMean = evenLayersMean/evenLayersDen;
359  //if(debug && oddLayersMean)
360  cout<<"[DTT0Calibration] Relative T0 mean for odd layers "<<oddLayersMean<<" even layers"<<evenLayersMean<<endl;
361 
362  //Compute sigma for odd and even superlayers
363  double oddLayersSigma=0;
364  double evenLayersSigma=0;
365  for(map<DTWireId, double>::const_iterator wiret0 = theRelativeT0PerWire.begin();
366  wiret0 != theRelativeT0PerWire.end();
367  wiret0++){
368  if((*wiret0).first.layerId().superlayerId() == (*sl)->id()){
369  if(((*wiret0).first.layerId().layer()) % 2){
370  oddLayersSigma = oddLayersSigma + ((*wiret0).second - oddLayersMean) * ((*wiret0).second - oddLayersMean);
371  }
372  else{
373  evenLayersSigma = evenLayersSigma + ((*wiret0).second - evenLayersMean) * ((*wiret0).second - evenLayersMean);
374  }
375  }
376  }
377  oddLayersSigma = oddLayersSigma/oddLayersDen;
378  evenLayersSigma = evenLayersSigma/evenLayersDen;
379  oddLayersSigma = sqrt(oddLayersSigma);
380  evenLayersSigma = sqrt(evenLayersSigma);
381 
382  //if(debug && oddLayersMean)
383  cout<<"[DTT0Calibration] Relative T0 sigma for odd layers "<<oddLayersSigma<<" even layers"<<evenLayersSigma<<endl;
384 
385  //Recompute the mean for odd and even superlayers discarding fluctations
386  double oddLayersFinalMean=0;
387  double evenLayersFinalMean=0;
388  for(map<DTWireId, double>::const_iterator wiret0 = theRelativeT0PerWire.begin();
389  wiret0 != theRelativeT0PerWire.end();
390  wiret0++){
391  if((*wiret0).first.layerId().superlayerId() == (*sl)->id()){
392  if(((*wiret0).first.layerId().layer()) % 2){
393  if(abs((*wiret0).second - oddLayersMean) < (2*oddLayersSigma))
394  oddLayersFinalMean = oddLayersFinalMean + (*wiret0).second;
395  }
396  else{
397  if(abs((*wiret0).second - evenLayersMean) < (2*evenLayersSigma))
398  evenLayersFinalMean = evenLayersFinalMean + (*wiret0).second;
399  }
400  }
401  }
402  oddLayersFinalMean = oddLayersFinalMean/oddLayersDen;
403  evenLayersFinalMean = evenLayersFinalMean/evenLayersDen;
404  //if(debug && oddLayersMean)
405  cout<<"[DTT0Calibration] Final relative T0 mean for odd layers "<<oddLayersFinalMean<<" even layers"<<evenLayersFinalMean<<endl;
406 
407  for(map<DTWireId, double>::const_iterator wiret0 = theRelativeT0PerWire.begin();
408  wiret0 != theRelativeT0PerWire.end();
409  wiret0++){
410  if((*wiret0).first.layerId().superlayerId() == (*sl)->id()){
411  double t0=-999;
412  if(((*wiret0).first.layerId().layer()) % 2)
413  t0 = (*wiret0).second + (evenLayersFinalMean - oddLayersFinalMean);
414  else
415  t0 = (*wiret0).second;
416 
417  cout << "[DTT0Calibration] Wire " << (*wiret0).first << " has t0 " << (*wiret0).second
418  << " (relative, after even-odd layer corrections) "
419  << " sigma " << theSigmaT0PerWire[(*wiret0).first] << endl;
420 
421  //Store the results into DB
422  t0sRelative->set((*wiret0).first, t0, theSigmaT0PerWire[(*wiret0).first],DTTimeUnits::counts);
423  }
424  }
425  }
426 
428  //if(debug)
429  cout << "[DTT0Calibration]Computing relative t0 wrt to chamber average" << endl;
430  //Compute the reference for each chamber
431  map<DTChamberId,double> sumT0ByChamber;
432  map<DTChamberId,int> countT0ByChamber;
433  for(DTT0::const_iterator tzero = t0sRelative->begin();
434  tzero != t0sRelative->end(); tzero++) {
435  int channelId = tzero->channelId;
436  if ( channelId == 0 ) continue;
437  DTWireId wireId(channelId);
438  DTChamberId chamberId(wireId.chamberId());
439  //sumT0ByChamber[chamberId] = sumT0ByChamber[chamberId] + tzero->t0mean;
440  // @@@ better DTT0 usage
441  float t0mean_f;
442  float t0rms_f;
443  t0sRelative->get(wireId,t0mean_f,t0rms_f,DTTimeUnits::counts);
444  sumT0ByChamber[chamberId] = sumT0ByChamber[chamberId] + t0mean_f;
445  // @@@ NEW DTT0 END
446  countT0ByChamber[chamberId]++;
447  }
448 
449  //Change reference for each wire and store the new t0s in the new map
450  for(DTT0::const_iterator tzero = t0sRelative->begin();
451  tzero != t0sRelative->end(); tzero++) {
452  int channelId = tzero->channelId;
453  if ( channelId == 0 ) continue;
454  DTWireId wireId(channelId);
455  DTChamberId chamberId(wireId.chamberId());
456  //double t0mean = (tzero->t0mean) - (sumT0ByChamber[chamberId]/countT0ByChamber[chamberId]);
457  //double t0rms = tzero->t0rms;
458  // @@@ better DTT0 usage
459  float t0mean_f;
460  float t0rms_f;
461  t0sRelative->get(wireId,t0mean_f,t0rms_f,DTTimeUnits::counts);
462  double t0mean = t0mean_f - (sumT0ByChamber[chamberId]/countT0ByChamber[chamberId]);
463  double t0rms = t0rms_f;
464  // @@@ NEW DTT0 END
465  t0sWRTChamber->set(wireId,
466  t0mean,
467  t0rms,
469  //if(debug)
470  //cout<<"Chamber "<<chamberId<<" has reference "<<(sumT0ByChamber[chamberId]/countT0ByChamber[chamberId]);
471  cout << "Changing t0 of wire " << wireId << " from " << t0mean_f
472  << " to " << t0mean << endl;
473  }
474  }
475 
477  if(debug)
478  cout << "[DTT0Calibration]Writing values in DB!" << endl;
479  // FIXME: to be read from cfg?
480  string t0Record = "DTT0Rcd";
481  // Write the t0 map to DB
482  if( correctByChamberMean_ ) DTCalibDBUtils::writeToDB(t0Record, t0sWRTChamber);
483  else DTCalibDBUtils::writeToDB(t0Record, t0sAbsolute);
484 }
485 
486 string DTT0Calibration::getHistoName(const DTWireId& wId) const {
487  string histoName;
488  stringstream theStream;
489  theStream << "Ch_" << wId.wheel() << "_" << wId.station() << "_" << wId.sector()
490  << "_SL" << wId.superlayer() << "_L" << wId.layer() << "_W"<< wId.wire() <<"_hT0Histo";
491  theStream >> histoName;
492  return histoName;
493 }
494 
495 string DTT0Calibration::getHistoName(const DTLayerId& lId) const {
496  string histoName;
497  stringstream theStream;
498  theStream << "Ch_" << lId.wheel() << "_" << lId.station() << "_" << lId.sector()
499  << "_SL" << lId.superlayer() << "_L" << lId.layer() <<"_hT0Histo";
500  theStream >> histoName;
501  return histoName;
502 }
503 
const_iterator begin() const
Definition: DTT0.cc:206
RunNumber_t run() const
Definition: EventID.h:42
int set(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float t0mean, float t0rms, DTTimeUnits::type unit)
Definition: DTT0.cc:142
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
T getUntrackedParameter(std::string const &, T const &) const
DTChamberId chamberId() const
Return the corresponding ChamberId.
#define abs(x)
Definition: mlp_lapack.h:159
std::string getHistoName(const DTWireId &wId) const
int layer() const
Return the layer number.
Definition: DTLayerId.h:55
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:61
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
int get(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, float &t0mean, float &t0rms, DTTimeUnits::type unit) const
Definition: DTT0.cc:69
std::vector< DTT0Data >::const_iterator const_iterator
Access methods to data.
Definition: DTT0.h:139
Definition: DTT0.h:52
T sqrt(T t)
Definition: SSEVec.h:48
virtual ~DTT0Calibration()
Destructor.
void endJob()
Compute the mean and the RMS of the t0 from the maps and write them to the DB with channel granularit...
int nevents
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
int wire() const
Return the wire number.
Definition: DTWireId.h:58
const_iterator end() const
Definition: DTT0.cc:211
int superlayer() const
Return the superlayer number (deprecated method name)
const T & get() const
Definition: EventSetup.h:55
std::vector< DigiType >::const_iterator const_iterator
edm::EventID id() const
Definition: EventBase.h:56
int sector() const
Definition: DTChamberId.h:63
static const double tzero[3]
std::pair< const_iterator, const_iterator > Range
tuple cout
Definition: gather_cfg.py:121
int station() const
Return the station number.
Definition: DTChamberId.h:53
DTT0Calibration(const edm::ParameterSet &pset)
Constructor.
#define debug
Definition: MEtoEDMFormat.h:34
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
static void writeToDB(std::string record, T *payload)
void analyze(const edm::Event &event, const edm::EventSetup &eventSetup)
Fill the maps with t0 (by channel)