CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
DTTPAnalyzer Class Reference
Inheritance diagram for DTTPAnalyzer:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 DTTPAnalyzer (const edm::ParameterSet &)
 
void endJob () override
 
 ~DTTPAnalyzer () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 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 Member Functions

std::string getHistoName (const DTLayerId &)
 

Private Attributes

edm::InputTag digiLabel_
 
edm::ESHandle< DTGeometrydtGeom_
 
const edm::ESGetToken< DTGeometry, MuonGeometryRecorddtGeomToken_
 
std::map< DTWireId, int > nDigisPerWire_
 
TFile * rootFile_
 
bool subtractT0_
 
std::map< DTWireId, double > sumW2PerWire_
 
std::map< DTWireId, double > sumWPerWire_
 
std::unique_ptr< DTTTrigBaseSynctTrigSync_
 

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

Author
A. Vilela Pereira

Definition at line 22 of file DTTPAnalyzer.cc.

Constructor & Destructor Documentation

◆ DTTPAnalyzer()

DTTPAnalyzer::DTTPAnalyzer ( const edm::ParameterSet pset)

Definition at line 65 of file DTTPAnalyzer.cc.

References edm::EDConsumerBase::consumesCollector(), get, muonDTDigis_cfi::pset, rootFile_, CSCSkim_cfi::rootFileName, AlCaHLTBitMon_QueryRunRegistry::string, subtractT0_, and tTrigSync_.

66  : subtractT0_(pset.getParameter<bool>("subtractT0")),
67  digiLabel_(pset.getParameter<edm::InputTag>("digiLabel")),
69  std::string rootFileName = pset.getUntrackedParameter<std::string>("rootFileName");
70  rootFile_ = new TFile(rootFileName.c_str(), "RECREATE");
71  rootFile_->cd();
72 
73  if (subtractT0_)
74  tTrigSync_ = DTTTrigSyncFactory::get()->create(pset.getParameter<std::string>("tTrigMode"),
75  pset.getParameter<edm::ParameterSet>("tTrigModeConfig"),
77 }
edm::InputTag digiLabel_
Definition: DTTPAnalyzer.cc:34
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
Definition: DTTPAnalyzer.cc:38
TFile * rootFile_
Definition: DTTPAnalyzer.cc:36
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::unique_ptr< DTTTrigBaseSync > tTrigSync_
Definition: DTTPAnalyzer.cc:39
#define get

◆ ~DTTPAnalyzer()

DTTPAnalyzer::~DTTPAnalyzer ( )
override

Definition at line 79 of file DTTPAnalyzer.cc.

References rootFile_.

79 { rootFile_->Close(); }
TFile * rootFile_
Definition: DTTPAnalyzer.cc:36

Member Function Documentation

◆ analyze()

void DTTPAnalyzer::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 81 of file DTTPAnalyzer.cc.

References digiLabel_, dtGeom_, dtGeomToken_, phase1PixelTopology::layer, nDigisPerWire_, hltrates_dqm_sourceclient-live_cfg::offset, singleTopDQM_cfi::setup, subtractT0_, sumW2PerWire_, sumWPerWire_, FrontierCondition_GT_autoExpress_cfi::t0, and tTrigSync_.

81  {
82  // Get the digis from the event
84  event.getByLabel(digiLabel_, digis);
85 
86  if (subtractT0_) {
87  tTrigSync_->setES(setup);
88  }
89  // Get the DT Geometry
90  dtGeom_ = setup.getHandle(dtGeomToken_);
91 
92  // Iterate through all digi collections ordered by LayerId
94  for (dtLayerIt = digis->begin(); dtLayerIt != digis->end(); ++dtLayerIt) {
95  // Get the iterators over the digis associated with this LayerId
96  const DTDigiCollection::Range& digiRange = (*dtLayerIt).second;
97 
98  // Get the layerId
99  const DTLayerId layerId = (*dtLayerIt).first; //FIXME: check to be in the right sector
100 
101  // Loop over all digis in the given layer
102  for (DTDigiCollection::const_iterator digi = digiRange.first; digi != digiRange.second; ++digi) {
103  const DTWireId wireId(layerId, (*digi).wire());
104 
105  double t0 = (*digi).countsTDC();
106 
107  //FIXME: Reject digis not coming from TP
108 
109  if (subtractT0_) {
110  const DTLayer* layer = nullptr; //fake
111  const GlobalPoint glPt; //fake
112  double offset = tTrigSync_->offset(layer, wireId, glPt);
113  t0 -= offset;
114  }
115 
116  if (nDigisPerWire_.find(wireId) == nDigisPerWire_.end()) {
117  nDigisPerWire_[wireId] = 0;
118  sumWPerWire_[wireId] = 0.;
119  sumW2PerWire_[wireId] = 0.;
120  }
121 
122  ++nDigisPerWire_[wireId];
123  sumWPerWire_[wireId] += t0;
124  sumW2PerWire_[wireId] += t0 * t0;
125  }
126  }
127 }
edm::InputTag digiLabel_
Definition: DTTPAnalyzer.cc:34
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
Definition: DTTPAnalyzer.cc:38
std::map< DTWireId, double > sumWPerWire_
Definition: DTTPAnalyzer.cc:43
std::map< DTWireId, int > nDigisPerWire_
Definition: DTTPAnalyzer.cc:42
constexpr std::array< uint8_t, layerIndexSize > layer
std::unique_ptr< DTTTrigBaseSync > tTrigSync_
Definition: DTTPAnalyzer.cc:39
std::map< DTWireId, double > sumW2PerWire_
Definition: DTTPAnalyzer.cc:44
std::pair< const_iterator, const_iterator > Range
std::vector< DigiType >::const_iterator const_iterator
edm::ESHandle< DTGeometry > dtGeom_
Definition: DTTPAnalyzer.cc:37

◆ endJob()

void DTTPAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 129 of file DTTPAnalyzer.cc.

References DTTopology::channels(), dtGeom_, DTTopology::firstChannel(), getHistoName(), HltBtagPostValidation_cff::histoName, crabWrapper::key, DTGeometry::layer(), DTWireId::layerId(), SiStripPI::mean, PFElectronDQMAnalyzer_cfi::nBin, nDigisPerWire_, SiStripPI::rms, rootFile_, DTLayer::specificTopology(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, sumW2PerWire_, sumWPerWire_, and DTWireId::wire().

Referenced by o2olib.O2ORunMgr::executeJob().

129  {
130  rootFile_->cd();
131  std::map<DTLayerId, TH1F*> meanHistoMap;
132  std::map<DTLayerId, TH1F*> sigmaHistoMap;
133  for (std::map<DTWireId, int>::const_iterator wireIdIt = nDigisPerWire_.begin(); wireIdIt != nDigisPerWire_.end();
134  ++wireIdIt) {
135  DTWireId wireId((*wireIdIt).first);
136 
137  int nDigis = nDigisPerWire_[wireId];
138  double sumW = sumWPerWire_[wireId];
139  double sumW2 = sumW2PerWire_[wireId];
140 
141  double mean = sumW / nDigis;
142  double rms = sumW2 / nDigis - mean * mean;
143  rms = sqrt(rms);
144 
145  DTLayerId layerId = wireId.layerId();
146  if (meanHistoMap.find(layerId) == meanHistoMap.end()) {
148  const int firstChannel = dtGeom_->layer(layerId)->specificTopology().firstChannel();
149  const int nWires = dtGeom_->layer(layerId)->specificTopology().channels();
150  TH1F* meanHistoTP = new TH1F((histoName + "_tpMean").c_str(),
151  "mean from test pulses by channel",
152  nWires,
153  firstChannel,
154  (firstChannel + nWires));
155  TH1F* sigmaHistoTP = new TH1F((histoName + "_tpSigma").c_str(),
156  "sigma from test pulses by channel",
157  nWires,
158  firstChannel,
159  (firstChannel + nWires));
160  meanHistoMap[layerId] = meanHistoTP;
161  sigmaHistoMap[layerId] = sigmaHistoTP;
162  }
163  // Fill the histograms
164  int nBin = meanHistoMap[layerId]->GetXaxis()->FindFixBin(wireId.wire());
165  meanHistoMap[layerId]->SetBinContent(nBin, mean);
166  sigmaHistoMap[layerId]->SetBinContent(nBin, rms);
167  }
168 
169  for (std::map<DTLayerId, TH1F*>::const_iterator key = meanHistoMap.begin(); key != meanHistoMap.end(); ++key) {
170  meanHistoMap[(*key).first]->Write();
171  sigmaHistoMap[(*key).first]->Write();
172  }
173 }
std::map< DTWireId, double > sumWPerWire_
Definition: DTTPAnalyzer.cc:43
std::map< DTWireId, int > nDigisPerWire_
Definition: DTTPAnalyzer.cc:42
TFile * rootFile_
Definition: DTTPAnalyzer.cc:36
std::string getHistoName(const DTLayerId &)
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:79
T sqrt(T t)
Definition: SSEVec.h:19
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
std::map< DTWireId, double > sumW2PerWire_
Definition: DTTPAnalyzer.cc:44
edm::ESHandle< DTGeometry > dtGeom_
Definition: DTTPAnalyzer.cc:37
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:76
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96

◆ getHistoName()

std::string DTTPAnalyzer::getHistoName ( const DTLayerId lId)
private

Definition at line 175 of file DTTPAnalyzer.cc.

References HltBtagPostValidation_cff::histoName, DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), AlCaHLTBitMon_QueryRunRegistry::string, DTSuperLayerId::superlayer(), and DTChamberId::wheel().

Referenced by endJob().

175  {
177  std::stringstream theStream;
178  theStream << "Ch_" << lId.wheel() << "_" << lId.station() << "_" << lId.sector() << "_SL" << lId.superlayer() << "_L"
179  << lId.layer();
180  theStream >> histoName;
181  return histoName;
182 }
int station() const
Return the station number.
Definition: DTChamberId.h:42
int superlayer() const
Return the superlayer number (deprecated method name)
int layer() const
Return the layer number.
Definition: DTLayerId.h:42
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
int sector() const
Definition: DTChamberId.h:49

Member Data Documentation

◆ digiLabel_

edm::InputTag DTTPAnalyzer::digiLabel_
private

Definition at line 34 of file DTTPAnalyzer.cc.

Referenced by analyze().

◆ dtGeom_

edm::ESHandle<DTGeometry> DTTPAnalyzer::dtGeom_
private

Definition at line 37 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

◆ dtGeomToken_

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

Definition at line 38 of file DTTPAnalyzer.cc.

Referenced by analyze().

◆ nDigisPerWire_

std::map<DTWireId, int> DTTPAnalyzer::nDigisPerWire_
private

Definition at line 42 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

◆ rootFile_

TFile* DTTPAnalyzer::rootFile_
private

Definition at line 36 of file DTTPAnalyzer.cc.

Referenced by DTTPAnalyzer(), endJob(), and ~DTTPAnalyzer().

◆ subtractT0_

bool DTTPAnalyzer::subtractT0_
private

Definition at line 33 of file DTTPAnalyzer.cc.

Referenced by analyze(), and DTTPAnalyzer().

◆ sumW2PerWire_

std::map<DTWireId, double> DTTPAnalyzer::sumW2PerWire_
private

Definition at line 44 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

◆ sumWPerWire_

std::map<DTWireId, double> DTTPAnalyzer::sumWPerWire_
private

Definition at line 43 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

◆ tTrigSync_

std::unique_ptr<DTTTrigBaseSync> DTTPAnalyzer::tTrigSync_
private

Definition at line 39 of file DTTPAnalyzer.cc.

Referenced by analyze(), and DTTPAnalyzer().