CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Attributes
DTVDriftCalibration Class Reference

#include <DTVDriftCalibration.h>

Inheritance diagram for DTVDriftCalibration:
edm::EDAnalyzer edm::EDConsumerBase

Classes

class  cellInfo
 

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup) override
 
 DTVDriftCalibration (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob () override
 
 ~DTVDriftCalibration () override
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef DTTMax::TMax TMax
 
enum  TMaxGranularity { byChamber, bySL, byPartition }
 

Private Attributes

bool debug
 
std::string digiLabel
 
bool findVDriftAndT0
 
h2DSegmh2DSegmRPhi
 
h2DSegmh2DSegmRZ
 
h4DSegmh4DSegmAllCh
 
std::unique_ptr< DTSegmentSelectorselect_
 
std::string theCalibChamber
 
edm::ParameterSet theCalibFilePar
 
TFile * theFile
 
std::unique_ptr< DTMeanTimerFittertheFitter
 
TMaxGranularity theGranularity
 
edm::EDGetTokenT< DTRecSegment4DCollectiontheRecHits4DToken
 
std::unique_ptr< DTTTrigBaseSynctheSync
 
std::string theVDriftOutputFile
 
std::map< DTWireId, cellInfo * > theWireIdAndCellMap
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

No description available.

Author
M. Giunta

Definition at line 34 of file DTVDriftCalibration.h.

Member Typedef Documentation

Definition at line 55 of file DTVDriftCalibration.h.

Member Enumeration Documentation

Constructor & Destructor Documentation

DTVDriftCalibration::DTVDriftCalibration ( const edm::ParameterSet pset)

Constructor.

Definition at line 47 of file DTVDriftCalibration.cc.

References bookHistos(), byChamber, byPartition, bySL, edm::EDConsumerBase::consumesCollector(), debug, Exception, findVDriftAndT0, reco::get(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), h2DSegmRPhi, h2DSegmRZ, h4DSegmAllCh, hChi2, muonDTDigis_cfi::pset, DTAnalyzerDetailed_cfi::rootFileName, select_, theCalibChamber, theCalibFilePar, theFile, theFitter, theGranularity, theRecHits4DToken, and theVDriftOutputFile.

47  :
48  // Get the synchronizer
49  theSync{DTTTrigSyncFactory::get()->create(pset.getParameter<string>("tTrigMode"),
50  pset.getParameter<ParameterSet>("tTrigModeConfig"))}
51 
52 {
53 
55  select_ = std::make_unique<DTSegmentSelector>(pset,collector);
56 
57  // The name of the 4D rec hits collection
58  theRecHits4DToken = (consumes<DTRecSegment4DCollection>(pset.getParameter<InputTag>("recHits4DLabel")));
59 
60  // The root file which will contain the histos
61  string rootFileName = pset.getUntrackedParameter<string>("rootFileName");
62  theFile = new TFile(rootFileName.c_str(), "RECREATE");
63  theFile->cd();
64 
65  debug = pset.getUntrackedParameter<bool>("debug", false);
66 
67  theFitter = std::make_unique<DTMeanTimerFitter>(theFile);
68  if(debug)
69  theFitter->setVerbosity(1);
70 
71  hChi2 = new TH1F("hChi2","Chi squared tracks",100,0,100);
72  h2DSegmRPhi = new h2DSegm("SLRPhi");
73  h2DSegmRZ = new h2DSegm("SLRZ");
74  h4DSegmAllCh = new h4DSegm("AllCh");
75  bookHistos();
76 
77  findVDriftAndT0 = pset.getUntrackedParameter<bool>("fitAndWrite", false);
78 
79  // Chamber/s to calibrate
80  theCalibChamber = pset.getUntrackedParameter<string>("calibChamber", "All");
81 
82  // the txt file which will contain the calibrated constants
83  theVDriftOutputFile = pset.getUntrackedParameter<string>("vDriftFileName");
84 
85  // get parameter set for DTCalibrationMap constructor
86  theCalibFilePar = pset.getUntrackedParameter<ParameterSet>("calibFileConfig");
87 
88  // the granularity to be used for tMax
89  string tMaxGranularity = pset.getUntrackedParameter<string>("tMaxGranularity","bySL");
90 
91  // Enforce it to be by SL since rest is not implemented
92  if(tMaxGranularity != "bySL"){
93  LogError("Calibration") << "[DTVDriftCalibration] tMaxGranularity will be fixed to bySL.";
94  tMaxGranularity = "bySL";
95  }
96  // Initialize correctly the enum which specify the granularity for the calibration
97  if(tMaxGranularity == "bySL") {
99  } else if(tMaxGranularity == "byChamber"){
101  } else if(tMaxGranularity== "byPartition") {
103  } else throw cms::Exception("Configuration") << "[DTVDriftCalibration] Check parameter tMaxGranularity: "
104  << tMaxGranularity << " option not available";
105 
106 
107  LogVerbatim("Calibration") << "[DTVDriftCalibration]Constructor called!";
108 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
TMaxGranularity theGranularity
std::unique_ptr< DTTTrigBaseSync > theSync
void bookHistos()
Definition: Histogram.h:33
edm::ParameterSet theCalibFilePar
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< DTRecSegment4DCollection > theRecHits4DToken
TH1F * hChi2
std::unique_ptr< DTMeanTimerFitter > theFitter
std::unique_ptr< DTSegmentSelector > select_
T get(const Candidate &c)
Definition: component.h:55
DTVDriftCalibration::~DTVDriftCalibration ( )
override

Destructor.

Definition at line 110 of file DTVDriftCalibration.cc.

References theFile.

110  {
111  theFile->Close();
112  LogVerbatim("Calibration") << "[DTVDriftCalibration]Destructor called!";
113 }

Member Function Documentation

void DTVDriftCalibration::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
override

Definition at line 115 of file DTVDriftCalibration.cc.

References DTVDriftCalibration::cellInfo::add(), bySL, relativeConstraints::chamber, DTGeometry::chamber(), h4DSegm::Fill(), h2DSegm::Fill(), edm::EventSetup::get(), DTTMax::getTMax(), h2DSegmRPhi, h2DSegmRZ, h4DSegmAllCh, hChi2, DTRecSegment2D::localDirection(), DTRecSegment2D::localPosition(), LogTrace, genParticles_cff::map, dataset::name, Geom::pi(), DTChamberId::sector(), select_, DTRecSegment2D::specificRecHits(), DTChamberId::station(), DTSuperLayerId::superLayer(), DTChamber::superLayer(), DTSLRecSegment2D::superLayerId(), DTLayerId::superlayerId(), theCalibChamber, theFile, theGranularity, theRecHits4DToken, theSync, PV3DBase< T, PVType, FrameType >::theta(), theWireIdAndCellMap, GeomDet::toGlobal(), GeomDet::toLocal(), DTVDriftCalibration::cellInfo::update(), DTChamberId::wheel(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

115  {
116  LogTrace("Calibration") << "--- [DTVDriftCalibration] Event analysed #Run: " << event.id().run()
117  << " #Event: " << event.id().event();
118  theFile->cd();
119  DTChamberId chosenChamberId;
120 
121  if(theCalibChamber != "All") {
122  stringstream linestr;
123  int selWheel, selStation, selSector;
124  linestr << theCalibChamber;
125  linestr >> selWheel >> selStation >> selSector;
126  chosenChamberId = DTChamberId(selWheel, selStation, selSector);
127  LogTrace("Calibration") << "chosen chamber " << chosenChamberId;
128  }
129 
130  // Get the DT Geometry
131  ESHandle<DTGeometry> dtGeom;
132  eventSetup.get<MuonGeometryRecord>().get(dtGeom);
133 
134  // Get the rechit collection from the event
135  Handle<DTRecSegment4DCollection> all4DSegments;
136  event.getByToken(theRecHits4DToken, all4DSegments);
137 
138  // Get the map of noisy channels
139  /*ESHandle<DTStatusFlag> statusMap;
140  if(checkNoisyChannels) {
141  eventSetup.get<DTStatusFlagRcd>().get(statusMap);
142  }*/
143 
144  // Set the event setup in the Synchronizer
145  theSync->setES(eventSetup);
146 
147  // Loop over segments by chamber
149  for (chamberIdIt = all4DSegments->id_begin();
150  chamberIdIt != all4DSegments->id_end();
151  ++chamberIdIt){
152 
153  // Get the chamber from the setup
154  const DTChamber* chamber = dtGeom->chamber(*chamberIdIt);
155  LogTrace("Calibration") << "Chamber Id: " << *chamberIdIt;
156 
157  // Calibrate just the chosen chamber/s
158  if((theCalibChamber != "All") && ((*chamberIdIt) != chosenChamberId))
159  continue;
160 
161  // Get the range for the corresponding ChamberId
162  DTRecSegment4DCollection::range range = all4DSegments->get((*chamberIdIt));
163 
164  // Loop over the rechits of this DetUnit
165  for (DTRecSegment4DCollection::const_iterator segment = range.first;
166  segment!=range.second; ++segment){
167 
168  if( !(*segment).hasZed() && !(*segment).hasPhi() ){
169  LogError("Calibration") << "4D segment without Z and Phi segments";
170  continue;
171  }
172 
173  LogTrace("Calibration") << "Segment local pos (in chamber RF): " << (*segment).localPosition()
174  << "\nSegment global pos: " << chamber->toGlobal((*segment).localPosition());
175 
176  if( !((*select_)(*segment, event, eventSetup)) ) continue;
177 
178  LocalPoint phiSeg2DPosInCham;
179  LocalVector phiSeg2DDirInCham;
180  map<DTSuperLayerId,vector<DTRecHit1D> > hitsBySLMap;
181  if((*segment).hasPhi()){
182  const DTChamberRecSegment2D* phiSeg = (*segment).phiSegment(); // phiSeg lives in the chamber RF
183  phiSeg2DPosInCham = phiSeg->localPosition();
184  phiSeg2DDirInCham = phiSeg->localDirection();
185  vector<DTRecHit1D> phiHits = phiSeg->specificRecHits();
186  for(vector<DTRecHit1D>::const_iterator hit = phiHits.begin();
187  hit != phiHits.end(); ++hit) {
188  DTWireId wireId = (*hit).wireId();
189  DTSuperLayerId slId = wireId.superlayerId();
190  hitsBySLMap[slId].push_back(*hit);
191  }
192  }
193  // Get the Theta 2D segment and plot the angle in the chamber RF
194  LocalVector zSeg2DDirInCham;
195  LocalPoint zSeg2DPosInCham;
196  if((*segment).hasZed()) {
197  const DTSLRecSegment2D* zSeg = (*segment).zSegment(); // zSeg lives in the SL RF
198  const DTSuperLayer* sl = chamber->superLayer(zSeg->superLayerId());
199  zSeg2DPosInCham = chamber->toLocal(sl->toGlobal((*zSeg).localPosition()));
200  zSeg2DDirInCham = chamber->toLocal(sl->toGlobal((*zSeg).localDirection()));
201  hitsBySLMap[zSeg->superLayerId()] = zSeg->specificRecHits();
202  }
203 
204  LocalPoint segment4DLocalPos = (*segment).localPosition();
205  LocalVector segment4DLocalDir = (*segment).localDirection();
206  double chiSquare = ((*segment).chi2()/(*segment).degreesOfFreedom());
207 
208  hChi2->Fill(chiSquare);
209  if((*segment).hasPhi())
210  h2DSegmRPhi->Fill(phiSeg2DPosInCham.x(), phiSeg2DDirInCham.x()/phiSeg2DDirInCham.z());
211  if((*segment).hasZed())
212  h2DSegmRZ->Fill(zSeg2DPosInCham.y(), zSeg2DDirInCham.y()/zSeg2DDirInCham.z());
213 
214  if((*segment).hasZed() && (*segment).hasPhi())
215  h4DSegmAllCh->Fill(segment4DLocalPos.x(),
216  segment4DLocalPos.y(),
217  atan(segment4DLocalDir.x()/segment4DLocalDir.z())*180./Geom::pi(),
218  atan(segment4DLocalDir.y()/segment4DLocalDir.z())*180./Geom::pi(),
219  180 - segment4DLocalDir.theta()*180./Geom::pi());
220  else if((*segment).hasPhi())
221  h4DSegmAllCh->Fill(segment4DLocalPos.x(),
222  atan(segment4DLocalDir.x()/segment4DLocalDir.z())*180./Geom::pi());
223  else if((*segment).hasZed())
224  LogWarning("Calibration") << "4d segment with only Z";
225 
226  //loop over the segments
227  for(map<DTSuperLayerId,vector<DTRecHit1D> >::const_iterator slIdAndHits = hitsBySLMap.begin(); slIdAndHits != hitsBySLMap.end(); ++slIdAndHits) {
228  if (slIdAndHits->second.size() < 3) continue;
229  DTSuperLayerId slId = slIdAndHits->first;
230 
231  // Create the DTTMax, that computes the 4 TMax
232  DTTMax slSeg(slIdAndHits->second, *(chamber->superLayer(slIdAndHits->first)),chamber->toGlobal((*segment).localDirection()), chamber->toGlobal((*segment).localPosition()), *theSync);
233 
234  if(theGranularity == bySL) {
235  vector<const TMax*> tMaxes = slSeg.getTMax(slId);
236  DTWireId wireId(slId, 0, 0);
237  theFile->cd();
238  cellInfo* cell = theWireIdAndCellMap[wireId];
239  if (cell==nullptr) {
240  TString name = (((((TString) "TMax"+(long) slId.wheel()) +(long) slId.station())
241  +(long) slId.sector())+(long) slId.superLayer());
242  cell = new cellInfo(name);
243  theWireIdAndCellMap[wireId] = cell;
244  }
245  cell->add(tMaxes);
246  cell->update(); // FIXME to reset the counter to avoid triple counting, which actually is not used...
247  }
248  else {
249  LogWarning("Calibration") << "[DTVDriftCalibration] ###Warning: the chosen granularity is not implemented yet, only bySL available!";
250  }
251  // to be implemented: granularity different from bySL
252 
253  // else if (theGranularity == byPartition) {
254  // // Use the custom granularity defined by partition();
255  // // in this case, add() should be called once for each Tmax of each layer
256  // // and triple counting should be avoided within add()
257  // vector<cellInfo*> cells;
258  // for (int i=1; i<=4; i++) {
259  // const DTTMax::InfoLayer* iLayer = slSeg.getInfoLayer(i);
260  // if(iLayer == 0) continue;
261  // cellInfo * cell = partition(iLayer->idWire);
262  // cells.push_back(cell);
263  // vector<const TMax*> tMaxes = slSeg.getTMax(iLayer->idWire);
264  // cell->add(tMaxes);
265  // }
266  // //reset the counter to avoid triple counting
267  // for (vector<cellInfo*>::const_iterator i = cells.begin();
268  // i!= cells.end(); i++) {
269  // (*i)->update();
270  // }
271  // }
272  }
273  }
274  }
275 }
const DTSuperLayer * superLayer(const DTSuperLayerId &id) const
Return the superlayer corresponding to the given id.
Definition: DTChamber.cc:65
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
TMaxGranularity theGranularity
const DTChamber * chamber(const DTChamberId &id) const
Return a DTChamber given its id.
Definition: DTGeometry.cc:117
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:54
std::unique_ptr< DTTTrigBaseSync > theSync
Definition: DTTMax.h:32
T y() const
Definition: PV3DBase.h:63
void Fill(float x, float y, float phi, float theta, float impact)
Definition: vDriftHistos.h:42
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:69
identifier iterator
Definition: RangeMap.h:135
void Fill(float pos, float localAngle)
Definition: vDriftHistos.h:97
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
Geom::Theta< T > theta() const
Definition: PV3DBase.h:75
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
std::map< DTWireId, cellInfo * > theWireIdAndCellMap
T z() const
Definition: PV3DBase.h:64
int superLayer() const
Return the superlayer number.
edm::EDGetTokenT< DTRecSegment4DCollection > theRecHits4DToken
TH1F * hChi2
#define LogTrace(id)
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
DTSuperLayerId superLayerId() const
The id of the superlayer on which reside the segment.
LocalPoint localPosition() const override
local position in SL frame
std::unique_ptr< DTSegmentSelector > select_
int sector() const
Definition: DTChamberId.h:61
LocalVector localDirection() const override
the local direction in SL frame
T get() const
Definition: EventSetup.h:71
constexpr double pi()
Definition: Pi.h:31
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
T x() const
Definition: PV3DBase.h:62
void DTVDriftCalibration::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 277 of file DTVDriftCalibration.cc.

References DTCalibrationMap::addCell(), bySL, DTVelocityUnits::cm_per_ns, findVDriftAndT0, DTCalibrationMap::getConsts(), DTVDriftCalibration::cellInfo::getHists(), DTCalibrationMap::getKey(), h2DSegmRPhi, h2DSegmRZ, h4DSegmAllCh, hChi2, DTWireId::layerId(), LogTrace, N, record, DTChamberId::sector(), DTMtime::set(), DTChamberId::station(), DTSuperLayerId::superLayer(), theCalibFilePar, theFile, theFitter, theGranularity, theVDriftOutputFile, theWireIdAndCellMap, DTChamberId::wheel(), h4DSegm::Write(), h2DSegm::Write(), hTMaxCell::Write(), and DTCalibrationMap::writeConsts().

Referenced by o2olib.O2ORunMgr::executeJob().

277  {
278  theFile->cd();
279  gROOT->GetList()->Write();
280  h2DSegmRPhi->Write();
281  h2DSegmRZ->Write();
282  h4DSegmAllCh->Write();
283  hChi2->Write();
284  // Instantiate a DTCalibrationMap object if you want to calculate the calibration constants
285  DTCalibrationMap calibValuesFile(theCalibFilePar);
286  // Create the object to be written to DB
287  DTMtime* mTime = new DTMtime();
288 
289  // write the TMax histograms of each SL to the root file
290  if(theGranularity == bySL) {
291  for(map<DTWireId, cellInfo*>::const_iterator wireCell = theWireIdAndCellMap.begin();
292  wireCell != theWireIdAndCellMap.end(); ++wireCell) {
293  cellInfo* cell= theWireIdAndCellMap[(*wireCell).first];
294  hTMaxCell* cellHists = cell->getHists();
295  theFile->cd();
296  cellHists->Write();
297  if(findVDriftAndT0) { // if TRUE: evaluate calibration constants from TMax hists filled in this job
298  // evaluate v_drift and sigma from the TMax histograms
299  DTWireId wireId = (*wireCell).first;
300  vector<float> newConstants;
301  TString N=(((((TString) "TMax"+(long) wireId.wheel()) +(long) wireId.station())
302  +(long) wireId.sector())+(long) wireId.superLayer());
303  vector<float> vDriftAndReso = theFitter->evaluateVDriftAndReso(N);
304 
305  // Don't write the constants for the SL if the vdrift was not computed
306  if(vDriftAndReso.front() == -1)
307  continue;
308  const DTCalibrationMap::CalibConsts* oldConstants = calibValuesFile.getConsts(wireId);
309  if(oldConstants != nullptr) {
310  newConstants.push_back((*oldConstants)[0]);
311  newConstants.push_back((*oldConstants)[1]);
312  newConstants.push_back((*oldConstants)[2]);
313  } else {
314  newConstants.push_back(-1);
315  newConstants.push_back(-1);
316  newConstants.push_back(-1);
317  }
318  for(int ivd=0; ivd<=5;ivd++) {
319  // 0=vdrift, 1=reso, 2=(3deltat0-2deltat0), 3=(2deltat0-1deltat0),
320  // 4=(1deltat0-0deltat0), 5=deltat0 from hists with max entries,
321  newConstants.push_back(vDriftAndReso[ivd]);
322  }
323 
324  calibValuesFile.addCell(calibValuesFile.getKey(wireId), newConstants);
325 
326  // vdrift is cm/ns , resolution is cm
327  mTime->set((wireId.layerId()).superlayerId(),
328  vDriftAndReso[0],
329  vDriftAndReso[1],
331  LogTrace("Calibration") << " SL: " << (wireId.layerId()).superlayerId()
332  << " vDrift = " << vDriftAndReso[0]
333  << " reso = " << vDriftAndReso[1];
334  }
335  }
336  }
337 
338  // to be implemented: granularity different from bySL
339 
340  // if(theGranularity == "byChamber") {
341  // const vector<DTChamber*> chambers = dMap.chambers();
342 
343  // // Loop over all chambers
344  // for(vector<MuBarChamber*>::const_iterator chamber = chambers.begin();
345  // chamber != chambers.end(); chamber ++) {
346  // MuBarChamberId chamber_id = (*chamber)->id();
347  // MuBarDigiParameters::Key wire_id(chamber_id, 0, 0, 0);
348  // vector<float> newConstants;
349  // vector<float> vDriftAndReso = evaluateVDriftAndReso(wire_id, f);
350  // const CalibConsts* oldConstants = digiParams.getConsts(wire_id);
351  // if(oldConstants !=0) {
352  // newConstants = *oldConstants;
353  // newConstants.push_back(vDriftAndReso[0]);
354  // newConstants.push_back(vDriftAndReso[1]);
355  // newConstants.push_back(vDriftAndReso[2]);
356  // newConstants.push_back(vDriftAndReso[3]);
357  // } else {
358  // newConstants.push_back(-1);
359  // newConstants.push_back(-1);
360  // newConstants.push_back(vDriftAndReso[0]);
361  // newConstants.push_back(vDriftAndReso[1]);
362  // newConstants.push_back(vDriftAndReso[2]);
363  // newConstants.push_back(vDriftAndReso[3]);
364  // }
365  // digiParams.addCell(wire_id, newConstants);
366  // }
367  // }
368 
369  // Write values to a table
370  calibValuesFile.writeConsts(theVDriftOutputFile);
371 
372  LogVerbatim("Calibration") << "[DTVDriftCalibration]Writing vdrift object to DB!";
373 
374  // Write the vdrift object to DB
375  string record = "DTMtimeRcd";
376  DTCalibDBUtils::writeToDB<DTMtime>(record, mTime);
377 }
TMaxGranularity theGranularity
JetCorrectorParameters::Record record
Definition: classes.h:7
int set(int wheelId, int stationId, int sectorId, int slId, float mTime, float mTrms, DTTimeUnits::type unit)
Definition: DTMtime.cc:250
void Write()
Definition: vDriftHistos.h:103
std::map< DTWireId, cellInfo * > theWireIdAndCellMap
edm::ParameterSet theCalibFilePar
std::vector< float > CalibConsts
int superLayer() const
Return the superlayer number.
TH1F * hChi2
void Write()
Definition: vDriftHistos.h:358
#define LogTrace(id)
std::unique_ptr< DTMeanTimerFitter > theFitter
#define N
Definition: blowfish.cc:9
DTLayerId layerId() const
Return the corresponding LayerId.
Definition: DTWireId.h:62
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
void Write()
Definition: vDriftHistos.h:53

Member Data Documentation

bool DTVDriftCalibration::debug
private
std::string DTVDriftCalibration::digiLabel
private

Definition at line 98 of file DTVDriftCalibration.h.

bool DTVDriftCalibration::findVDriftAndT0
private

Definition at line 108 of file DTVDriftCalibration.h.

Referenced by DTVDriftCalibration(), and endJob().

h2DSegm* DTVDriftCalibration::h2DSegmRPhi
private

Definition at line 81 of file DTVDriftCalibration.h.

Referenced by analyze(), DTVDriftCalibration(), and endJob().

h2DSegm* DTVDriftCalibration::h2DSegmRZ
private

Definition at line 80 of file DTVDriftCalibration.h.

Referenced by analyze(), DTVDriftCalibration(), and endJob().

h4DSegm* DTVDriftCalibration::h4DSegmAllCh
private

Definition at line 82 of file DTVDriftCalibration.h.

Referenced by analyze(), DTVDriftCalibration(), and endJob().

std::unique_ptr<DTSegmentSelector> DTVDriftCalibration::select_
private

Definition at line 52 of file DTVDriftCalibration.h.

Referenced by analyze(), and DTVDriftCalibration().

std::string DTVDriftCalibration::theCalibChamber
private

Definition at line 135 of file DTVDriftCalibration.h.

Referenced by analyze(), and DTVDriftCalibration().

edm::ParameterSet DTVDriftCalibration::theCalibFilePar
private

Definition at line 123 of file DTVDriftCalibration.h.

Referenced by DTVDriftCalibration(), and endJob().

TFile* DTVDriftCalibration::theFile
private

Definition at line 101 of file DTVDriftCalibration.h.

Referenced by analyze(), DTVDriftCalibration(), endJob(), and ~DTVDriftCalibration().

std::unique_ptr<DTMeanTimerFitter> DTVDriftCalibration::theFitter
private

Definition at line 104 of file DTVDriftCalibration.h.

Referenced by DTVDriftCalibration(), and endJob().

TMaxGranularity DTVDriftCalibration::theGranularity
private

Definition at line 89 of file DTVDriftCalibration.h.

Referenced by analyze(), DTVDriftCalibration(), and endJob().

edm::EDGetTokenT<DTRecSegment4DCollection> DTVDriftCalibration::theRecHits4DToken
private

Definition at line 92 of file DTVDriftCalibration.h.

Referenced by analyze(), and DTVDriftCalibration().

std::unique_ptr<DTTTrigBaseSync> DTVDriftCalibration::theSync
private

Definition at line 120 of file DTVDriftCalibration.h.

Referenced by analyze().

std::string DTVDriftCalibration::theVDriftOutputFile
private

Definition at line 111 of file DTVDriftCalibration.h.

Referenced by DTVDriftCalibration(), and endJob().

std::map<DTWireId, cellInfo*> DTVDriftCalibration::theWireIdAndCellMap
private

Definition at line 114 of file DTVDriftCalibration.h.

Referenced by analyze(), and endJob().