CMS 3D CMS Logo

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

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
 DTTPAnalyzer (const edm::ParameterSet &)
 
void endJob () override
 
 ~DTTPAnalyzer () override
 
- 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
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_
 
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::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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Author
A. Vilela Pereira

Definition at line 20 of file DTTPAnalyzer.cc.

Constructor & Destructor Documentation

◆ DTTPAnalyzer()

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

Definition at line 68 of file DTTPAnalyzer.cc.

69  : subtractT0_(pset.getParameter<bool>("subtractT0")), digiLabel_(pset.getParameter<edm::InputTag>("digiLabel")) {
70  std::string rootFileName = pset.getUntrackedParameter<std::string>("rootFileName");
71  rootFile_ = new TFile(rootFileName.c_str(), "RECREATE");
72  rootFile_->cd();
73 
74  if (subtractT0_)
75  tTrigSync_ = DTTTrigSyncFactory::get()->create(pset.getParameter<std::string>("tTrigMode"),
76  pset.getParameter<edm::ParameterSet>("tTrigModeConfig"));
77 }

References get, muonDTDigis_cfi::pset, rootFile_, CSCSkim_cfi::rootFileName, AlCaHLTBitMon_QueryRunRegistry::string, subtractT0_, and tTrigSync_.

◆ ~DTTPAnalyzer()

DTTPAnalyzer::~DTTPAnalyzer ( )
override

Definition at line 79 of file DTTPAnalyzer.cc.

79 { rootFile_->Close(); }

References rootFile_.

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 93 of file DTTPAnalyzer.cc.

93  {
94  // Get the digis from the event
96  event.getByLabel(digiLabel_, digis);
97 
98  // Iterate through all digi collections ordered by LayerId
100  for (dtLayerIt = digis->begin(); dtLayerIt != digis->end(); ++dtLayerIt) {
101  // Get the iterators over the digis associated with this LayerId
102  const DTDigiCollection::Range& digiRange = (*dtLayerIt).second;
103 
104  // Get the layerId
105  const DTLayerId layerId = (*dtLayerIt).first; //FIXME: check to be in the right sector
106 
107  // Loop over all digis in the given layer
108  for (DTDigiCollection::const_iterator digi = digiRange.first; digi != digiRange.second; ++digi) {
109  const DTWireId wireId(layerId, (*digi).wire());
110 
111  double t0 = (*digi).countsTDC();
112 
113  //FIXME: Reject digis not coming from TP
114 
115  if (subtractT0_) {
116  const DTLayer* layer = nullptr; //fake
117  const GlobalPoint glPt; //fake
118  double offset = tTrigSync_->offset(layer, wireId, glPt);
119  t0 -= offset;
120  }
121 
122  if (nDigisPerWire_.find(wireId) == nDigisPerWire_.end()) {
123  nDigisPerWire_[wireId] = 0;
124  sumWPerWire_[wireId] = 0.;
125  sumW2PerWire_[wireId] = 0.;
126  }
127 
128  ++nDigisPerWire_[wireId];
129  sumWPerWire_[wireId] += t0;
130  sumW2PerWire_[wireId] += t0 * t0;
131  }
132  }
133 }

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

◆ beginRun()

void DTTPAnalyzer::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 81 of file DTTPAnalyzer.cc.

81  {
82  // Get the t0 map from the DB
83  if (subtractT0_) {
84  /*ESHandle<DTT0> t0;
85  setup.get<DTT0Rcd>().get(t0);
86  tZeroMap_ = &*t0;*/
87  tTrigSync_->setES(setup);
88  }
89  // Get the DT Geometry
91 }

References dtGeom_, get, singleTopDQM_cfi::setup, subtractT0_, and tTrigSync_.

◆ endJob()

void DTTPAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 135 of file DTTPAnalyzer.cc.

135  {
136  rootFile_->cd();
137  std::map<DTLayerId, TH1F*> meanHistoMap;
138  std::map<DTLayerId, TH1F*> sigmaHistoMap;
139  for (std::map<DTWireId, int>::const_iterator wireIdIt = nDigisPerWire_.begin(); wireIdIt != nDigisPerWire_.end();
140  ++wireIdIt) {
141  DTWireId wireId((*wireIdIt).first);
142 
143  int nDigis = nDigisPerWire_[wireId];
144  double sumW = sumWPerWire_[wireId];
145  double sumW2 = sumW2PerWire_[wireId];
146 
147  double mean = sumW / nDigis;
148  double rms = sumW2 / nDigis - mean * mean;
149  rms = sqrt(rms);
150 
151  DTLayerId layerId = wireId.layerId();
152  if (meanHistoMap.find(layerId) == meanHistoMap.end()) {
154  const int firstChannel = dtGeom_->layer(layerId)->specificTopology().firstChannel();
155  const int nWires = dtGeom_->layer(layerId)->specificTopology().channels();
156  TH1F* meanHistoTP = new TH1F((histoName + "_tpMean").c_str(),
157  "mean from test pulses by channel",
158  nWires,
159  firstChannel,
160  (firstChannel + nWires));
161  TH1F* sigmaHistoTP = new TH1F((histoName + "_tpSigma").c_str(),
162  "sigma from test pulses by channel",
163  nWires,
164  firstChannel,
165  (firstChannel + nWires));
166  meanHistoMap[layerId] = meanHistoTP;
167  sigmaHistoMap[layerId] = sigmaHistoTP;
168  }
169  // Fill the histograms
170  int nBin = meanHistoMap[layerId]->GetXaxis()->FindFixBin(wireId.wire());
171  meanHistoMap[layerId]->SetBinContent(nBin, mean);
172  sigmaHistoMap[layerId]->SetBinContent(nBin, rms);
173  }
174 
175  for (std::map<DTLayerId, TH1F*>::const_iterator key = meanHistoMap.begin(); key != meanHistoMap.end(); ++key) {
176  meanHistoMap[(*key).first]->Write();
177  sigmaHistoMap[(*key).first]->Write();
178  }
179 }

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().

◆ getHistoName()

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

Definition at line 181 of file DTTPAnalyzer.cc.

181  {
183  std::stringstream theStream;
184  theStream << "Ch_" << lId.wheel() << "_" << lId.station() << "_" << lId.sector() << "_SL" << lId.superlayer() << "_L"
185  << lId.layer();
186  theStream >> histoName;
187  return histoName;
188 }

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

Referenced by endJob().

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 38 of file DTTPAnalyzer.cc.

Referenced by beginRun(), and endJob().

◆ 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(), beginRun(), 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(), beginRun(), and DTTPAnalyzer().

DTTPAnalyzer::tTrigSync_
std::unique_ptr< DTTTrigBaseSync > tTrigSync_
Definition: DTTPAnalyzer.cc:39
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
DTTPAnalyzer::getHistoName
std::string getHistoName(const DTLayerId &)
Definition: DTTPAnalyzer.cc:181
DTTopology::channels
int channels() const
Returns the number of wires in the layer.
Definition: DTTopology.h:76
DTSuperLayerId::superlayer
int superlayer() const
Return the superlayer number (deprecated method name)
Definition: DTSuperLayerId.h:42
SiStripPI::rms
Definition: SiStripPayloadInspectorHelper.h:169
edm::Handle< DTDigiCollection >
PFElectronDQMAnalyzer_cfi.nBin
nBin
Definition: PFElectronDQMAnalyzer_cfi.py:25
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
MuonDigiCollection::const_iterator
std::vector< DigiType >::const_iterator const_iterator
Definition: MuonDigiCollection.h:94
DTTopology::firstChannel
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:79
DTWireId
Definition: DTWireId.h:12
FrontierCondition_GT_autoExpress_cfi.t0
t0
Definition: FrontierCondition_GT_autoExpress_cfi.py:149
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
Point3DBase< float, GlobalTag >
DTLayerId
Definition: DTLayerId.h:12
DTTPAnalyzer::subtractT0_
bool subtractT0_
Definition: DTTPAnalyzer.cc:33
phase1PixelTopology::layer
constexpr std::array< uint8_t, layerIndexSize > layer
Definition: phase1PixelTopology.h:99
edm::ParameterSet
Definition: ParameterSet.h:47
DTGeometry::layer
const DTLayer * layer(const DTLayerId &id) const
Return a layer given its id.
Definition: DTGeometry.cc:96
DTTPAnalyzer::digiLabel_
edm::InputTag digiLabel_
Definition: DTTPAnalyzer.cc:34
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DTLayer
Definition: DTLayer.h:25
DTTPAnalyzer::sumWPerWire_
std::map< DTWireId, double > sumWPerWire_
Definition: DTTPAnalyzer.cc:43
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
DTTPAnalyzer::nDigisPerWire_
std::map< DTWireId, int > nDigisPerWire_
Definition: DTTPAnalyzer.cc:42
DTTPAnalyzer::rootFile_
TFile * rootFile_
Definition: DTTPAnalyzer.cc:36
HltBtagPostValidation_cff.histoName
histoName
Definition: HltBtagPostValidation_cff.py:17
MuonDigiCollection::Range
std::pair< const_iterator, const_iterator > Range
Definition: MuonDigiCollection.h:95
CSCSkim_cfi.rootFileName
rootFileName
Definition: CSCSkim_cfi.py:9
DTLayer::specificTopology
const DTTopology & specificTopology() const
Definition: DTLayer.cc:37
DTTPAnalyzer::sumW2PerWire_
std::map< DTWireId, double > sumW2PerWire_
Definition: DTTPAnalyzer.cc:44
hltrates_dqm_sourceclient-live_cfg.offset
offset
Definition: hltrates_dqm_sourceclient-live_cfg.py:82
DigiContainerIterator
Definition: MuonDigiCollection.h:30
DTLayerId::layer
int layer() const
Return the layer number.
Definition: DTLayerId.h:42
crabWrapper.key
key
Definition: crabWrapper.py:19
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
edm::InputTag
Definition: InputTag.h:15
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
DTTPAnalyzer::dtGeom_
edm::ESHandle< DTGeometry > dtGeom_
Definition: DTTPAnalyzer.cc:38