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 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,
MuonGeometryRecord
dtGeomToken_
 
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< B > consumes (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 () noexcept
 
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...
 
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 ( const edm::ParameterSet pset)

Definition at line 65 of file DTTPAnalyzer.cc.

References edm::EDConsumerBase::consumesCollector(), get, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), rootFile_, dtT0Analyzer_cfg::rootFileName, AlCaHLTBitMon_QueryRunRegistry::string, subtractT0_, and tTrigSync_.

66  : subtractT0_(pset.getParameter<bool>("subtractT0")),
67  digiLabel_(pset.getParameter<edm::InputTag>("digiLabel")),
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 }
T getUntrackedParameter(std::string const &, T const &) const
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
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
#define get
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

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_, edm::EventSetup::getHandle(), phase1PixelTopology::layer, nDigisPerWire_, hltrates_dqm_sourceclient-live_cfg::offset, 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
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
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
void DTTPAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 129 of file DTTPAnalyzer.cc.

References dtGeom_, getHistoName(), submitPVResolutionJobs::key, DTWireId::layerId(), SiStripPI::mean, nDigisPerWire_, SiStripPI::rms, rootFile_, 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()) {
147  std::string histoName = getHistoName(layerId);
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 &)
T sqrt(T t)
Definition: SSEVec.h:19
tuple key
prepare the HTCondor submission files and eventually submit them
std::map< DTWireId, double > sumW2PerWire_
Definition: DTTPAnalyzer.cc:44
edm::ESHandle< DTGeometry > dtGeom_
Definition: DTTPAnalyzer.cc:37
std::string DTTPAnalyzer::getHistoName ( const DTLayerId lId)
private

Definition at line 175 of file DTTPAnalyzer.cc.

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

Referenced by endJob().

175  {
176  std::string histoName;
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 layer() const
Return the layer number.
Definition: DTLayerId.h:42
int superlayer() const
Return the superlayer number (deprecated method name)
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

Member Data Documentation

edm::InputTag DTTPAnalyzer::digiLabel_
private

Definition at line 34 of file DTTPAnalyzer.cc.

Referenced by analyze().

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

Definition at line 37 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

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

Definition at line 38 of file DTTPAnalyzer.cc.

Referenced by analyze().

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

Definition at line 42 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

TFile* DTTPAnalyzer::rootFile_
private

Definition at line 36 of file DTTPAnalyzer.cc.

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

bool DTTPAnalyzer::subtractT0_
private

Definition at line 33 of file DTTPAnalyzer.cc.

Referenced by analyze(), and DTTPAnalyzer().

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

Definition at line 44 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

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

Definition at line 43 of file DTTPAnalyzer.cc.

Referenced by analyze(), and endJob().

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

Definition at line 39 of file DTTPAnalyzer.cc.

Referenced by analyze(), and DTTPAnalyzer().