CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
virtual ~DTTPAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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_
 
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 &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Detailed Description

Author
A. Vilela Pereira

Definition at line 20 of file DTTPAnalyzer.cc.

Constructor & Destructor Documentation

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

Definition at line 68 of file DTTPAnalyzer.cc.

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

68  :
69  subtractT0_(pset.getParameter<bool>("subtractT0")),
70  digiLabel_(pset.getParameter<edm::InputTag>("digiLabel")),
71  tTrigSync_(0) {
72 
74  rootFile_ = new TFile(rootFileName.c_str(), "RECREATE");
75  rootFile_->cd();
76 
77  if(subtractT0_)
78  tTrigSync_ = DTTTrigSyncFactory::get()->create(pset.getParameter<std::string>("tTrigMode"),
79  pset.getParameter<edm::ParameterSet>("tTrigModeConfig"));
80 
81 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::InputTag digiLabel_
Definition: DTTPAnalyzer.cc:34
DTTTrigBaseSync * tTrigSync_
Definition: DTTPAnalyzer.cc:39
TFile * rootFile_
Definition: DTTPAnalyzer.cc:36
T get(const Candidate &c)
Definition: component.h:55
DTTPAnalyzer::~DTTPAnalyzer ( )
virtual

Definition at line 83 of file DTTPAnalyzer.cc.

References rootFile_.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 99 of file DTTPAnalyzer.cc.

References digiLabel_, nDigisPerWire_, DTTTrigBaseSync::offset(), hltrates_dqm_sourceclient-live_cfg::offset, subtractT0_, sumW2PerWire_, sumWPerWire_, and tTrigSync_.

99  {
100 
101  // Get the digis from the event
103  event.getByLabel(digiLabel_, digis);
104 
105  // Iterate through all digi collections ordered by LayerId
107  for (dtLayerIt = digis->begin();
108  dtLayerIt != digis->end();
109  ++dtLayerIt){
110  // Get the iterators over the digis associated with this LayerId
111  const DTDigiCollection::Range& digiRange = (*dtLayerIt).second;
112 
113  // Get the layerId
114  const DTLayerId layerId = (*dtLayerIt).first; //FIXME: check to be in the right sector
115 
116  // Loop over all digis in the given layer
117  for (DTDigiCollection::const_iterator digi = digiRange.first;
118  digi != digiRange.second;
119  ++digi) {
120  const DTWireId wireId( layerId, (*digi).wire() );
121 
122  double t0 = (*digi).countsTDC();
123 
124  //FIXME: Reject digis not coming from TP
125 
126  if(subtractT0_) {
127  const DTLayer* layer = 0; //fake
128  const GlobalPoint glPt; //fake
129  double offset = tTrigSync_->offset(layer, wireId, glPt);
130  t0 -= offset;
131  }
132 
133  if(nDigisPerWire_.find(wireId) == nDigisPerWire_.end()){
134  nDigisPerWire_[wireId] = 0;
135  sumWPerWire_[wireId] = 0.;
136  sumW2PerWire_[wireId] = 0.;
137  }
138 
139  ++nDigisPerWire_[wireId];
140  sumWPerWire_[wireId] += t0;
141  sumW2PerWire_[wireId] += t0*t0;
142  }
143 
144  }
145 }
edm::InputTag digiLabel_
Definition: DTTPAnalyzer.cc:34
std::map< DTWireId, double > sumWPerWire_
Definition: DTTPAnalyzer.cc:43
double offset(const DTLayer *layer, const DTWireId &wireId, const GlobalPoint &globalPos)
std::map< DTWireId, int > nDigisPerWire_
Definition: DTTPAnalyzer.cc:42
DTTTrigBaseSync * tTrigSync_
Definition: DTTPAnalyzer.cc:39
std::map< DTWireId, double > sumW2PerWire_
Definition: DTTPAnalyzer.cc:44
std::vector< DTDigi >::const_iterator const_iterator
std::pair< const_iterator, const_iterator > Range
void DTTPAnalyzer::beginRun ( const edm::Run run,
const edm::EventSetup setup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 87 of file DTTPAnalyzer.cc.

References dtGeom_, edm::EventSetup::get(), DTTTrigBaseSync::setES(), subtractT0_, and tTrigSync_.

87  {
88  // Get the t0 map from the DB
89  if(subtractT0_){
90  /*ESHandle<DTT0> t0;
91  setup.get<DTT0Rcd>().get(t0);
92  tZeroMap_ = &*t0;*/
93  tTrigSync_->setES(setup);
94  }
95  // Get the DT Geometry
96  setup.get<MuonGeometryRecord>().get(dtGeom_);
97 }
DTTTrigBaseSync * tTrigSync_
Definition: DTTPAnalyzer.cc:39
virtual void setES(const edm::EventSetup &setup)=0
Pass the Event Setup to the synchronization module at each event.
const T & get() const
Definition: EventSetup.h:56
edm::ESHandle< DTGeometry > dtGeom_
Definition: DTTPAnalyzer.cc:38
void DTTPAnalyzer::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 147 of file DTTPAnalyzer.cc.

References dtGeom_, getHistoName(), relval_steps::key, DTWireId::layerId(), timingPdfMaker::mean, nDigisPerWire_, plotscripts::rms(), rootFile_, mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, sumW2PerWire_, sumWPerWire_, and DTWireId::wire().

147  {
148  rootFile_->cd();
149  std::map<DTLayerId, TH1F*> meanHistoMap;
150  std::map<DTLayerId, TH1F*> sigmaHistoMap;
151  for(std::map<DTWireId, int>::const_iterator wireIdIt = nDigisPerWire_.begin();
152  wireIdIt != nDigisPerWire_.end(); ++wireIdIt){
153  DTWireId wireId((*wireIdIt).first);
154 
155  int nDigis = nDigisPerWire_[wireId];
156  double sumW = sumWPerWire_[wireId];
157  double sumW2 = sumW2PerWire_[wireId];
158 
159  double mean = sumW/nDigis;
160  double rms = sumW2/nDigis - mean*mean;
161  rms = sqrt(rms);
162 
163  DTLayerId layerId = wireId.layerId();
164  if(meanHistoMap.find(layerId) == meanHistoMap.end()) {
165  std::string histoName = getHistoName(layerId);
166  const int firstChannel = dtGeom_->layer(layerId)->specificTopology().firstChannel();
167  const int nWires = dtGeom_->layer(layerId)->specificTopology().channels();
168  TH1F* meanHistoTP = new TH1F((histoName + "_tpMean").c_str(),"mean from test pulses by channel",
169  nWires,firstChannel,(firstChannel + nWires));
170  TH1F* sigmaHistoTP = new TH1F((histoName + "_tpSigma").c_str(),"sigma from test pulses by channel",
171  nWires,firstChannel,(firstChannel + nWires));
172  meanHistoMap[layerId] = meanHistoTP;
173  sigmaHistoMap[layerId] = sigmaHistoTP;
174  }
175  // Fill the histograms
176  int nBin = meanHistoMap[layerId]->GetXaxis()->FindFixBin(wireId.wire());
177  meanHistoMap[layerId]->SetBinContent(nBin,mean);
178  sigmaHistoMap[layerId]->SetBinContent(nBin,rms);
179  }
180 
181  for(std::map<DTLayerId, TH1F*>::const_iterator key = meanHistoMap.begin();
182  key != meanHistoMap.end(); ++key){
183  meanHistoMap[(*key).first]->Write();
184  sigmaHistoMap[(*key).first]->Write();
185  }
186 
187 }
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:48
string key
FastSim: produces sample of signal events, overlayed with premixed minbias events.
std::map< DTWireId, double > sumW2PerWire_
Definition: DTTPAnalyzer.cc:44
edm::ESHandle< DTGeometry > dtGeom_
Definition: DTTPAnalyzer.cc:38
std::string DTTPAnalyzer::getHistoName ( const DTLayerId lId)
private

Definition at line 189 of file DTTPAnalyzer.cc.

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

Referenced by endJob().

189  {
190  std::string histoName;
191  std::stringstream theStream;
192  theStream << "Ch_" << lId.wheel() << "_" << lId.station() << "_" << lId.sector()
193  << "_SL" << lId.superlayer() << "_L" << lId.layer();
194  theStream >> histoName;
195  return histoName;
196 }
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
int superlayer() const
Return the superlayer number (deprecated method name)
int sector() const
Definition: DTChamberId.h:61
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45

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

Referenced by beginRun(), and endJob().

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

DTTTrigBaseSync* DTTPAnalyzer::tTrigSync_
private

Definition at line 39 of file DTTPAnalyzer.cc.

Referenced by analyze(), beginRun(), and DTTPAnalyzer().