CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
DTVDriftSegmentCalibration Class Reference

#include <DTVDriftSegmentCalibration.h>

Inheritance diagram for DTVDriftSegmentCalibration:
edm::one::EDAnalyzer< edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &eventSetup) override
 
void beginJob () override
 
void beginRun (const edm::Run &run, const edm::EventSetup &setup) override
 
 DTVDriftSegmentCalibration (const edm::ParameterSet &pset)
 
void endJob () override
 
void endRun (const edm::Run &run, const edm::EventSetup &setup) override
 
 ~DTVDriftSegmentCalibration () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDAnalyzerBase () 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
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::map< DTChamberId,
std::vector< TH1F * > > 
ChamberHistosMapTH1F
 
typedef std::map< DTChamberId,
std::vector< TH2F * > > 
ChamberHistosMapTH2F
 

Private Member Functions

void bookHistos (DTChamberId)
 

Private Attributes

const edm::ESGetToken
< DTGeometry,
MuonGeometryRecord
dtGeomToken_
 
TFile * rootFile_
 
DTSegmentSelectorselect_
 
std::string theCalibChamber_
 
edm::InputTag theRecHits4DLabel_
 
ChamberHistosMapTH1F theVDriftHistoMapTH1F_
 
ChamberHistosMapTH2F theVDriftHistoMapTH2F_
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Produces histograms from v-drift computation in segment fit to be used for v-drift calibration

Author
A. Vilela Pereira

Definition at line 24 of file DTVDriftSegmentCalibration.h.

Member Typedef Documentation

typedef std::map<DTChamberId, std::vector<TH1F*> > DTVDriftSegmentCalibration::ChamberHistosMapTH1F
private

Definition at line 38 of file DTVDriftSegmentCalibration.h.

typedef std::map<DTChamberId, std::vector<TH2F*> > DTVDriftSegmentCalibration::ChamberHistosMapTH2F
private

Definition at line 39 of file DTVDriftSegmentCalibration.h.

Constructor & Destructor Documentation

DTVDriftSegmentCalibration::DTVDriftSegmentCalibration ( const edm::ParameterSet pset)

Definition at line 33 of file DTVDriftSegmentCalibration.cc.

References edm::EDConsumerBase::consumesCollector(), edm::ParameterSet::getUntrackedParameter(), HLT_FULL_cff::InputTag, rootFile_, dtT0Analyzer_cfg::rootFileName, select_, and theRecHits4DLabel_.

34  : theRecHits4DLabel_(pset.getParameter<InputTag>("recHits4DLabel")),
35  //writeVDriftDB_(pset.getUntrackedParameter<bool>("writeVDriftDB", false)),
36  theCalibChamber_(pset.getUntrackedParameter<string>("calibChamber", "All")),
38  LogVerbatim("Calibration") << "[DTVDriftSegmentCalibration] Constructor called!";
39 
41  select_ = new DTSegmentSelector(pset, collector);
42  consumes<DTRecSegment4DCollection>(edm::InputTag(theRecHits4DLabel_));
43  // the root file which will contain the histos
44  string rootFileName = pset.getUntrackedParameter<string>("rootFileName", "DTVDriftHistos.root");
45  rootFile_ = new TFile(rootFileName.c_str(), "RECREATE");
46  rootFile_->cd();
47 }
Log< level::Info, true > LogVerbatim
T getUntrackedParameter(std::string const &, T const &) const
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DTVDriftSegmentCalibration::~DTVDriftSegmentCalibration ( )
override

Definition at line 53 of file DTVDriftSegmentCalibration.cc.

References rootFile_.

53  {
54  rootFile_->Close();
55  LogVerbatim("Calibration") << "[DTVDriftSegmentCalibration] Destructor called!";
56 }
Log< level::Info, true > LogVerbatim

Member Function Documentation

void DTVDriftSegmentCalibration::analyze ( const edm::Event event,
const edm::EventSetup eventSetup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 58 of file DTVDriftSegmentCalibration.cc.

References bookHistos(), DTChamberId, dtGeomToken_, edmPickEvents::event, HcalObjRepresent::Fill(), edm::EventSetup::getHandle(), LogTrace, sistrip::SpyUtilities::range(), rootFile_, select_, theCalibChamber_, theRecHits4DLabel_, theVDriftHistoMapTH1F_, theVDriftHistoMapTH2F_, and GeomDet::toGlobal().

58  {
59  rootFile_->cd();
60 
61  // Get the DT Geometry
62  ESHandle<DTGeometry> dtGeom;
63  dtGeom = eventSetup.getHandle(dtGeomToken_);
64 
65  // Get the rechit collection from the event
67  event.getByLabel(theRecHits4DLabel_, all4DSegments);
68 
69  DTChamberId chosenChamberId;
70  if (theCalibChamber_ != "All") {
71  stringstream linestr;
72  int selWheel, selStation, selSector;
73  linestr << theCalibChamber_;
74  linestr >> selWheel >> selStation >> selSector;
75  chosenChamberId = DTChamberId(selWheel, selStation, selSector);
76  LogVerbatim("Calibration") << " Chosen chamber: " << chosenChamberId << endl;
77  }
78  // Loop over segments by chamber
80  for (chamberIdIt = all4DSegments->id_begin(); chamberIdIt != all4DSegments->id_end(); ++chamberIdIt) {
81  // Calibrate just the chosen chamber/s
82  if ((theCalibChamber_ != "All") && ((*chamberIdIt) != chosenChamberId))
83  continue;
84 
85  // Book histos
86  if (theVDriftHistoMapTH1F_.find(*chamberIdIt) == theVDriftHistoMapTH1F_.end()) {
87  LogTrace("Calibration") << " Booking histos for Chamber: " << *chamberIdIt;
88  bookHistos(*chamberIdIt);
89  }
90 
91  // Get the chamber from the setup
92  const DTChamber* chamber = dtGeom->chamber(*chamberIdIt);
93  // Get the range for the corresponding ChamberId
94  DTRecSegment4DCollection::range range = all4DSegments->get((*chamberIdIt));
95  // Loop over the rechits of this DetUnit
96  for (DTRecSegment4DCollection::const_iterator segment = range.first; segment != range.second; ++segment) {
97  LogTrace("Calibration") << "Segment local pos (in chamber RF): " << (*segment).localPosition()
98  << "\nSegment global pos: " << chamber->toGlobal((*segment).localPosition());
99 
100  if (!(*select_)(*segment, event, eventSetup))
101  continue;
102 
103  // Fill v-drift values
104  if ((*segment).hasPhi()) {
105  //if( segment->phiSegment()->ist0Valid() ){
106  double segmentVDrift = segment->phiSegment()->vDrift();
107  if (segmentVDrift != 0.00) {
108  (theVDriftHistoMapTH1F_[*chamberIdIt])[0]->Fill(segmentVDrift);
109  (theVDriftHistoMapTH2F_[*chamberIdIt])[0]->Fill(segment->localPosition().x(), segmentVDrift);
110  (theVDriftHistoMapTH2F_[*chamberIdIt])[1]->Fill(segment->localPosition().y(), segmentVDrift);
111  }
112  }
113  // Probably not meaningful
114  if ((*segment).hasZed()) {
115  //if( segment->zSegment()->ist0Valid() ){
116  double segmentVDrift = segment->zSegment()->vDrift();
117  if (segmentVDrift != 0.00) {
118  (theVDriftHistoMapTH1F_[*chamberIdIt])[1]->Fill(segmentVDrift);
119  }
120  }
121  } // DTRecSegment4DCollection::const_iterator segment
122  } // DTRecSegment4DCollection::id_iterator chamberIdIt
123 } // DTVDriftSegmentCalibration::analyze
Log< level::Info, true > LogVerbatim
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
identifier iterator
Definition: RangeMap.h:130
#define LogTrace(id)
const uint16_t range(const Frame &aFrame)
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
ChamberHistosMapTH1F theVDriftHistoMapTH1F_
ChamberHistosMapTH2F theVDriftHistoMapTH2F_
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:151
void DTVDriftSegmentCalibration::beginJob ( )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 49 of file DTVDriftSegmentCalibration.cc.

49 { TH1::SetDefaultSumw2(true); }
void DTVDriftSegmentCalibration::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
override

Definition at line 51 of file DTVDriftSegmentCalibration.cc.

51 {}
void DTVDriftSegmentCalibration::bookHistos ( DTChamberId  chId)
private

Definition at line 150 of file DTVDriftSegmentCalibration.cc.

References DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, theVDriftHistoMapTH1F_, theVDriftHistoMapTH2F_, cond::impl::to_string(), and DTChamberId::wheel().

Referenced by analyze().

150  {
151  // Compose the chamber name
152  std::string wheel = std::to_string(chId.wheel());
154  std::string sector = std::to_string(chId.sector());
155 
156  string chHistoName = "_W" + wheel + "_St" + station + "_Sec" + sector;
157 
158  vector<TH1F*> histosTH1F;
159  histosTH1F.push_back(
160  new TH1F(("hRPhiVDriftCorr" + chHistoName).c_str(), "v-drift corr. from Phi segments", 200, -0.4, 0.4));
161  if (chId.station() != 4)
162  histosTH1F.push_back(
163  new TH1F(("hRZVDriftCorr" + chHistoName).c_str(), "v-drift corr. from Z segments", 200, -0.4, 0.4));
164 
165  vector<TH2F*> histosTH2F;
166  histosTH2F.push_back(new TH2F(("hRPhiVDriftCorrVsSegmPosX" + chHistoName).c_str(),
167  "v-drift corr. vs. segment x position",
168  250,
169  -125.,
170  125.,
171  200,
172  -0.4,
173  0.4));
174  histosTH2F.push_back(new TH2F(("hRPhiVDriftCorrVsSegmPosY" + chHistoName).c_str(),
175  "v-drift corr. vs. segment y position",
176  250,
177  -125.,
178  125.,
179  200,
180  -0.4,
181  0.4));
182  //if(chId.station() != 4) ...
183 
184  theVDriftHistoMapTH1F_[chId] = histosTH1F;
185  theVDriftHistoMapTH2F_[chId] = histosTH2F;
186 }
std::string to_string(const V &value)
Definition: OMSAccess.h:71
ChamberHistosMapTH1F theVDriftHistoMapTH1F_
ChamberHistosMapTH2F theVDriftHistoMapTH2F_
int sector() const
Definition: DTChamberId.h:49
int station() const
Return the station number.
Definition: DTChamberId.h:42
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
void DTVDriftSegmentCalibration::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 125 of file DTVDriftSegmentCalibration.cc.

References rootFile_, theVDriftHistoMapTH1F_, and theVDriftHistoMapTH2F_.

Referenced by o2olib.O2ORunMgr::executeJob().

125  {
126  rootFile_->cd();
127 
128  LogVerbatim("Calibration") << "[DTVDriftSegmentCalibration] Writing histos to file!" << endl;
129 
130  for (ChamberHistosMapTH1F::const_iterator itChHistos = theVDriftHistoMapTH1F_.begin();
131  itChHistos != theVDriftHistoMapTH1F_.end();
132  ++itChHistos) {
133  vector<TH1F*>::const_iterator itHistTH1F = (*itChHistos).second.begin();
134  vector<TH1F*>::const_iterator itHistTH1F_end = (*itChHistos).second.end();
135  for (; itHistTH1F != itHistTH1F_end; ++itHistTH1F)
136  (*itHistTH1F)->Write();
137 
138  vector<TH2F*>::const_iterator itHistTH2F = theVDriftHistoMapTH2F_[(*itChHistos).first].begin();
139  vector<TH2F*>::const_iterator itHistTH2F_end = theVDriftHistoMapTH2F_[(*itChHistos).first].end();
140  for (; itHistTH2F != itHistTH2F_end; ++itHistTH2F)
141  (*itHistTH2F)->Write();
142  }
143 
144  /*if(writeVDriftDB_){
145  // ...
146  }*/
147 }
Log< level::Info, true > LogVerbatim
ChamberHistosMapTH1F theVDriftHistoMapTH1F_
ChamberHistosMapTH2F theVDriftHistoMapTH2F_
void DTVDriftSegmentCalibration::endRun ( const edm::Run run,
const edm::EventSetup setup 
)
inlineoverride

Definition at line 34 of file DTVDriftSegmentCalibration.h.

34 {};

Member Data Documentation

const edm::ESGetToken<DTGeometry, MuonGeometryRecord> DTVDriftSegmentCalibration::dtGeomToken_
private

Definition at line 52 of file DTVDriftSegmentCalibration.h.

Referenced by analyze().

TFile* DTVDriftSegmentCalibration::rootFile_
private
DTSegmentSelector* DTVDriftSegmentCalibration::select_
private

Definition at line 42 of file DTVDriftSegmentCalibration.h.

Referenced by analyze(), and DTVDriftSegmentCalibration().

std::string DTVDriftSegmentCalibration::theCalibChamber_
private

Definition at line 46 of file DTVDriftSegmentCalibration.h.

Referenced by analyze().

edm::InputTag DTVDriftSegmentCalibration::theRecHits4DLabel_
private

Definition at line 44 of file DTVDriftSegmentCalibration.h.

Referenced by analyze(), and DTVDriftSegmentCalibration().

ChamberHistosMapTH1F DTVDriftSegmentCalibration::theVDriftHistoMapTH1F_
private

Definition at line 49 of file DTVDriftSegmentCalibration.h.

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

ChamberHistosMapTH2F DTVDriftSegmentCalibration::theVDriftHistoMapTH2F_
private

Definition at line 50 of file DTVDriftSegmentCalibration.h.

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