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 noexcept final
 
bool wantsGlobalRuns () const noexcept final
 
bool wantsInputProcessBlocks () const noexcept final
 
bool wantsProcessBlocks () const noexcept 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 noexcept
 
bool wantsStreamRuns () const noexcept
 
 ~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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

std::string getHistoName (const DTLayerId &)
 

Private Attributes

const edm::EDGetTokenT< DTDigiCollectiondigiToken_
 
edm::ESHandle< DTGeometrydtGeom_
 
const edm::ESGetToken< DTGeometry, MuonGeometryRecorddtGeomToken_
 
std::map< DTWireId, int > nDigisPerWire_
 
TFile * rootFile_
 
const 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 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 23 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  digiToken_(consumes<DTDigiCollection>(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 }
const edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeomToken_
Definition: DTTPAnalyzer.cc:39
const bool subtractT0_
Definition: DTTPAnalyzer.cc:34
TFile * rootFile_
Definition: DTTPAnalyzer.cc:37
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::unique_ptr< DTTTrigBaseSync > tTrigSync_
Definition: DTTPAnalyzer.cc:40
const edm::EDGetTokenT< DTDigiCollection > digiToken_
Definition: DTTPAnalyzer.cc:35
#define get

◆ ~DTTPAnalyzer()

DTTPAnalyzer::~DTTPAnalyzer ( )
override

Definition at line 79 of file DTTPAnalyzer.cc.

References rootFile_.

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

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

◆ endJob()

void DTTPAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 128 of file DTTPAnalyzer.cc.

References DTTopology::channels(), dtGeom_, DTTopology::firstChannel(), getHistoName(), HltBtagPostValidation_cff::histoName, submitPVResolutionJobs::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().

128  {
129  rootFile_->cd();
130  std::map<DTLayerId, TH1F*> meanHistoMap;
131  std::map<DTLayerId, TH1F*> sigmaHistoMap;
132  for (std::map<DTWireId, int>::const_iterator wireIdIt = nDigisPerWire_.begin(); wireIdIt != nDigisPerWire_.end();
133  ++wireIdIt) {
134  DTWireId wireId((*wireIdIt).first);
135 
136  int nDigis = nDigisPerWire_[wireId];
137  double sumW = sumWPerWire_[wireId];
138  double sumW2 = sumW2PerWire_[wireId];
139 
140  double mean = sumW / nDigis;
141  double rms = sumW2 / nDigis - mean * mean;
142  rms = sqrt(rms);
143 
144  DTLayerId layerId = wireId.layerId();
145  if (meanHistoMap.find(layerId) == meanHistoMap.end()) {
147  const int firstChannel = dtGeom_->layer(layerId)->specificTopology().firstChannel();
148  const int nWires = dtGeom_->layer(layerId)->specificTopology().channels();
149  TH1F* meanHistoTP = new TH1F((histoName + "_tpMean").c_str(),
150  "mean from test pulses by channel",
151  nWires,
152  firstChannel,
153  (firstChannel + nWires));
154  TH1F* sigmaHistoTP = new TH1F((histoName + "_tpSigma").c_str(),
155  "sigma from test pulses by channel",
156  nWires,
157  firstChannel,
158  (firstChannel + nWires));
159  meanHistoMap[layerId] = meanHistoTP;
160  sigmaHistoMap[layerId] = sigmaHistoTP;
161  }
162  // Fill the histograms
163  int nBin = meanHistoMap[layerId]->GetXaxis()->FindFixBin(wireId.wire());
164  meanHistoMap[layerId]->SetBinContent(nBin, mean);
165  sigmaHistoMap[layerId]->SetBinContent(nBin, rms);
166  }
167 
168  for (std::map<DTLayerId, TH1F*>::const_iterator key = meanHistoMap.begin(); key != meanHistoMap.end(); ++key) {
169  meanHistoMap[(*key).first]->Write();
170  sigmaHistoMap[(*key).first]->Write();
171  }
172 }
std::map< DTWireId, double > sumWPerWire_
Definition: DTTPAnalyzer.cc:44
std::map< DTWireId, int > nDigisPerWire_
Definition: DTTPAnalyzer.cc:43
TFile * rootFile_
Definition: DTTPAnalyzer.cc:37
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:23
key
prepare the HTCondor submission files and eventually submit them
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
std::map< DTWireId, double > sumW2PerWire_
Definition: DTTPAnalyzer.cc:45
edm::ESHandle< DTGeometry > dtGeom_
Definition: DTTPAnalyzer.cc:38
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 174 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().

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

Member Data Documentation

◆ digiToken_

const edm::EDGetTokenT<DTDigiCollection> DTTPAnalyzer::digiToken_
private

Definition at line 35 of file DTTPAnalyzer.cc.

Referenced by analyze().

◆ dtGeom_

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

Definition at line 38 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

◆ dtGeomToken_

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

Definition at line 39 of file DTTPAnalyzer.cc.

Referenced by analyze().

◆ nDigisPerWire_

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

Definition at line 43 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

◆ rootFile_

TFile* DTTPAnalyzer::rootFile_
private

Definition at line 37 of file DTTPAnalyzer.cc.

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

◆ subtractT0_

const bool DTTPAnalyzer::subtractT0_
private

Definition at line 34 of file DTTPAnalyzer.cc.

Referenced by analyze(), and DTTPAnalyzer().

◆ sumW2PerWire_

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

Definition at line 45 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

◆ sumWPerWire_

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

Definition at line 44 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

◆ tTrigSync_

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

Definition at line 40 of file DTTPAnalyzer.cc.

Referenced by analyze(), and DTTPAnalyzer().