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
DTtTrigDBValidation Class Reference

#include <DTtTrigDBValidation.h>

Inheritance diagram for DTtTrigDBValidation:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginRun (edm::Run const &, edm::EventSetup const &)
 Operations. More...
 
 DTtTrigDBValidation (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob ()
 
void endRun (edm::Run const &, edm::EventSetup const &)
 
virtual ~DTtTrigDBValidation ()
 Destructor. More...
 
- 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

void bookHistos (int, int)
 
void bookHistos (int wheel)
 
int slFromBin (int bin) const
 
int stationFromBin (int bin) const
 

Private Attributes

DQMStoredbe_
 
edm::ESHandle< DTGeometrydtGeom_
 
int higherLimit_
 
std::string labelDB_
 
std::string labelDBRef_
 
int lowerLimit_
 
std::string metname_
 
std::string outputFileName_
 
bool outputMEsInRootFile_
 
std::map< std::pair< int, int >
, MonitorElement * > 
tTrigDiffHistos_
 
std::map< int, MonitorElement * > tTrigDiffWheel_
 
std::map< DTSuperLayerId,
std::pair< float, float > > 
tTrigMap_
 
std::map< DTSuperLayerId,
std::pair< float, float > > 
tTrigRefMap_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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

Definition at line 24 of file DTtTrigDBValidation.h.

Constructor & Destructor Documentation

DTtTrigDBValidation::DTtTrigDBValidation ( const edm::ParameterSet pset)

Constructor.

Definition at line 33 of file DTtTrigDBValidation.cc.

References dbe_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), metname_, cppFunctionSkipper::operator, outputFileName_, outputMEsInRootFile_, DQMStore::setCurrentFolder(), and AlCaHLTBitMon_QueryRunRegistry::string.

33  :
34  metname_("TTrigDBValidation"),
35  labelDBRef_(pset.getParameter<string>("labelDBRef")),
36  labelDB_(pset.getParameter<string>("labelDB")),
37  lowerLimit_(pset.getUntrackedParameter<int>("lowerLimit",1)),
38  higherLimit_(pset.getUntrackedParameter<int>("higherLimit",3))
39  {
40 
41  LogVerbatim(metname_) << "[DTtTrigDBValidation] Constructor called!";
42 
43  // Get the DQM needed services
45  dbe_->setCurrentFolder("DT/DtCalib/TTrigDBValidation");
46 
47  outputMEsInRootFile_ = false;
48  if( pset.exists("OutputFileName") ){
49  outputMEsInRootFile_ = true;
50  outputFileName_ = pset.getParameter<std::string>("OutputFileName");
51  }
52 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
bool exists(std::string const &parameterName) const
checks if a parameter exists
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
DTtTrigDBValidation::~DTtTrigDBValidation ( )
virtual

Destructor.

Definition at line 54 of file DTtTrigDBValidation.cc.

54 {}

Member Function Documentation

void DTtTrigDBValidation::analyze ( edm::Event const &  ,
edm::EventSetup const &   
)
inlinevirtual

Implements edm::EDAnalyzer.

Definition at line 36 of file DTtTrigDBValidation.h.

36 {}
void DTtTrigDBValidation::beginRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
)
virtual

Operations.

Reimplemented from edm::EDAnalyzer.

Definition at line 56 of file DTtTrigDBValidation.cc.

References funct::abs(), DTTtrig::begin(), bookHistos(), dtGeom_, DTTtrig::end(), edm::EventSetup::get(), DTTtrig::get(), higherLimit_, labelDB_, labelDBRef_, LogTrace, lowerLimit_, python.multivaluedict::map(), metname_, DTTimeUnits::ns, relativeConstraints::station, tTrigDiffHistos_, tTrigDiffWheel_, tTrigMap_, and tTrigRefMap_.

56  {
57 
58  LogVerbatim(metname_) << "[DTtTrigDBValidation] Parameters initialization";
59 
60  ESHandle<DTTtrig> tTrig_Ref;
61  setup.get<DTTtrigRcd>().get(labelDBRef_, tTrig_Ref);
62  const DTTtrig* DTTtrigRefMap = &*tTrig_Ref;
63  LogVerbatim(metname_) << "[DTtTrigDBValidation] reference Ttrig version: " << tTrig_Ref->version();
64 
65  ESHandle<DTTtrig> tTrig;
66  setup.get<DTTtrigRcd>().get(labelDB_, tTrig);
67  const DTTtrig* DTTtrigMap = &*tTrig;
68  LogVerbatim(metname_) << "[DTtTrigDBValidation] Ttrig to validate version: " << tTrig->version();
69 
70  //book&reset the summary histos
71  for(int wheel=-2; wheel<=2; wheel++){
72  bookHistos(wheel);
73  tTrigDiffWheel_[wheel]->Reset();
74  }
75 
76  // Get the geometry
77  setup.get<MuonGeometryRecord>().get(dtGeom_);
78 
79  // Loop over Ref DB entries
80  for(DTTtrig::const_iterator it = DTTtrigRefMap->begin();
81  it != DTTtrigRefMap->end(); ++it) {
82  DTSuperLayerId slId((*it).first.wheelId,
83  (*it).first.stationId,
84  (*it).first.sectorId,
85  (*it).first.slId);
86  float tTrigMean;
87  float tTrigRms;
88  float kFactor;
89  DTTtrigRefMap->get(slId, tTrigMean, tTrigRms, kFactor, DTTimeUnits::ns);
90  float tTrigCorr = tTrigMean + kFactor*tTrigRms;
91  LogTrace(metname_)<< "Ref Superlayer: " << slId << "\n"
92  << " Ttrig mean (ns): " << tTrigMean
93  << " Ttrig rms (ns): " << tTrigRms
94  << " Ttrig k-Factor: " << kFactor
95  << " Ttrig value (ns): " << tTrigCorr;
96 
97  //tTrigRefMap[slId] = std::pair<float,float>(tTrigmean,tTrigrms);
98  tTrigRefMap_[slId] = pair<float,float>(tTrigCorr,tTrigRms);
99  }
100 
101  // Loop over Ref DB entries
102  for(DTTtrig::const_iterator it = DTTtrigMap->begin();
103  it != DTTtrigMap->end(); ++it) {
104  DTSuperLayerId slId((*it).first.wheelId,
105  (*it).first.stationId,
106  (*it).first.sectorId,
107  (*it).first.slId);
108  float tTrigMean;
109  float tTrigRms;
110  float kFactor;
111  DTTtrigMap->get(slId, tTrigMean, tTrigRms, kFactor, DTTimeUnits::ns);
112  float tTrigCorr = tTrigMean + kFactor*tTrigRms;
113  LogTrace(metname_)<< "Superlayer: " << slId << "\n"
114  << " Ttrig mean (ns): " << tTrigMean
115  << " Ttrig rms (ns): " << tTrigRms
116  << " Ttrig k-Factor: " << kFactor
117  << " Ttrig value (ns): " << tTrigCorr;
118 
119  //tTrigMap[slId] = std::pair<float,float>(tTrigmean,tTrigrms);
120  tTrigMap_[slId] = pair<float,float>(tTrigCorr,tTrigRms);
121  }
122 
123  for(map<DTSuperLayerId, pair<float,float> >::const_iterator it = tTrigRefMap_.begin();
124  it != tTrigRefMap_.end(); ++it) {
125  if(tTrigMap_.find((*it).first) == tTrigMap_.end()) continue;
126 
127  // compute the difference
128  float difference = tTrigMap_[(*it).first].first - (*it).second.first;
129 
130  //book histo
131  int wheel = (*it).first.chamberId().wheel();
132  int sector = (*it).first.chamberId().sector();
133  if(tTrigDiffHistos_.find(make_pair(wheel,sector)) == tTrigDiffHistos_.end()) bookHistos(wheel,sector);
134 
135  LogTrace(metname_) << "Filling histos for super-layer: " << (*it).first << " difference: " << difference;
136 
137  // Fill the test histos
138  int entry = -1;
139  int station = (*it).first.chamberId().station();
140  if(station == 1) entry=0;
141  if(station == 2) entry=3;
142  if(station == 3) entry=6;
143  if(station == 4) entry=9;
144 
145  int slBin = entry + (*it).first.superLayer();
146  if(slBin == 12) slBin=11;
147 
148  tTrigDiffHistos_[make_pair(wheel,sector)]->setBinContent(slBin, difference);
149  if(abs(difference) < lowerLimit_){
150  tTrigDiffWheel_[wheel]->setBinContent(slBin,sector,1);
151  }else if(abs(difference) < higherLimit_){
152  tTrigDiffWheel_[wheel]->setBinContent(slBin,sector,2);
153  }else{
154  tTrigDiffWheel_[wheel]->setBinContent(slBin,sector,3);
155  }
156 
157 
158  } // Loop over the tTrig map reference
159 
160 }
std::map< int, MonitorElement * > tTrigDiffWheel_
std::map< std::pair< int, int >, MonitorElement * > tTrigDiffHistos_
std::vector< std::pair< DTTtrigId, DTTtrigData > >::const_iterator const_iterator
Access methods to data.
Definition: DTTtrig.h:183
edm::ESHandle< DTGeometry > dtGeom_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define LogTrace(id)
std::map< DTSuperLayerId, std::pair< float, float > > tTrigRefMap_
std::map< DTSuperLayerId, std::pair< float, float > > tTrigMap_
int get(int wheelId, int stationId, int sectorId, int slId, float &tTrig, float &tTrms, float &kFact, DTTimeUnits::type unit) const
get content
Definition: DTTtrig.cc:85
const_iterator begin() const
Definition: DTTtrig.cc:354
const_iterator end() const
Definition: DTTtrig.cc:359
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void DTtTrigDBValidation::bookHistos ( int  wheel,
int  sector 
)
private

Definition at line 172 of file DTtTrigDBValidation.cc.

References DQMStore::book1D(), dbe_, LogTrace, metname_, DQMStore::setCurrentFolder(), and tTrigDiffHistos_.

Referenced by beginRun().

172  {
173 
174  LogTrace(metname_) << " Booking histos for Wheel, Sector: " << wheel << ", " << sector;
175 
176  // Compose the chamber name
177  stringstream str_wheel; str_wheel << wheel;
178  stringstream str_sector; str_sector << sector;
179 
180  string lHistoName = "_W" + str_wheel.str() + "_Sec" + str_sector.str();
181 
182  dbe_->setCurrentFolder("DT/DtCalib/TTrigDBValidation/Wheel" + str_wheel.str());
183 
184  // Create the monitor elements
185  MonitorElement * hDifference;
186  hDifference = dbe_->book1D("TTrigDifference"+lHistoName, "difference between the two tTrig values",11,0,11);
187 
188  pair<int,int> mypair(wheel,sector);
189  tTrigDiffHistos_[mypair] = hDifference;
190 
191  (tTrigDiffHistos_[mypair])->setBinLabel(1,"MB1_SL1",1);
192  (tTrigDiffHistos_[mypair])->setBinLabel(2,"MB1_SL2",1);
193  (tTrigDiffHistos_[mypair])->setBinLabel(3,"MB1_SL3",1);
194  (tTrigDiffHistos_[mypair])->setBinLabel(4,"MB2_SL1",1);
195  (tTrigDiffHistos_[mypair])->setBinLabel(5,"MB2_SL2",1);
196  (tTrigDiffHistos_[mypair])->setBinLabel(6,"MB2_SL3",1);
197  (tTrigDiffHistos_[mypair])->setBinLabel(7,"MB3_SL1",1);
198  (tTrigDiffHistos_[mypair])->setBinLabel(8,"MB3_SL2",1);
199  (tTrigDiffHistos_[mypair])->setBinLabel(9,"MB3_SL3",1);
200  (tTrigDiffHistos_[mypair])->setBinLabel(10,"MB4_SL1",1);
201  (tTrigDiffHistos_[mypair])->setBinLabel(11,"MB4_SL3",1);
202 
203 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:942
std::map< std::pair< int, int >, MonitorElement * > tTrigDiffHistos_
#define LogTrace(id)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
void DTtTrigDBValidation::bookHistos ( int  wheel)
private

Definition at line 206 of file DTtTrigDBValidation.cc.

References DQMStore::book2D(), dbe_, DQMStore::setCurrentFolder(), and tTrigDiffWheel_.

206  {
207 
208  stringstream wh; wh << wheel;
209 
210  dbe_->setCurrentFolder("DT/DtCalib/TTrigDBValidation");
211  tTrigDiffWheel_[wheel] = dbe_->book2D("TTrigDifference_W"+wh.str(), "W"+wh.str()+": summary of tTrig differences",11,1,12,14,1,15);
212  tTrigDiffWheel_[wheel]->setBinLabel(1,"MB1_SL1",1);
213  tTrigDiffWheel_[wheel]->setBinLabel(2,"MB1_SL2",1);
214  tTrigDiffWheel_[wheel]->setBinLabel(3,"MB1_SL3",1);
215  tTrigDiffWheel_[wheel]->setBinLabel(4,"MB2_SL1",1);
216  tTrigDiffWheel_[wheel]->setBinLabel(5,"MB2_SL2",1);
217  tTrigDiffWheel_[wheel]->setBinLabel(6,"MB2_SL3",1);
218  tTrigDiffWheel_[wheel]->setBinLabel(7,"MB3_SL1",1);
219  tTrigDiffWheel_[wheel]->setBinLabel(8,"MB3_SL2",1);
220  tTrigDiffWheel_[wheel]->setBinLabel(9,"MB3_SL3",1);
221  tTrigDiffWheel_[wheel]->setBinLabel(10,"MB4_SL1",1);
222  tTrigDiffWheel_[wheel]->setBinLabel(11,"MB4_SL3",1);
223 
224 }
std::map< int, MonitorElement * > tTrigDiffWheel_
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1070
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:655
void DTtTrigDBValidation::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 164 of file DTtTrigDBValidation.cc.

References dbe_, outputFileName_, outputMEsInRootFile_, and DQMStore::save().

164  {
165 
167  // write the histos on a file
169  }
170 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2490
void DTtTrigDBValidation::endRun ( edm::Run const &  run,
edm::EventSetup const &  setup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 162 of file DTtTrigDBValidation.cc.

162 {}
int DTtTrigDBValidation::slFromBin ( int  bin) const
private

Definition at line 231 of file DTtTrigDBValidation.cc.

References run_regression::ret.

231  {
232  int ret = bin%3;
233  if(ret == 0 || bin == 11) ret = 3;
234 
235  return ret;
236 }
int DTtTrigDBValidation::stationFromBin ( int  bin) const
private

Definition at line 227 of file DTtTrigDBValidation.cc.

227  {
228  return (int) (bin /3.1)+1;
229 }

Member Data Documentation

DQMStore* DTtTrigDBValidation::dbe_
private

Definition at line 54 of file DTtTrigDBValidation.h.

Referenced by bookHistos(), DTtTrigDBValidation(), and endJob().

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

Definition at line 56 of file DTtTrigDBValidation.h.

Referenced by beginRun().

int DTtTrigDBValidation::higherLimit_
private

Definition at line 48 of file DTtTrigDBValidation.h.

Referenced by beginRun().

std::string DTtTrigDBValidation::labelDB_
private

Definition at line 45 of file DTtTrigDBValidation.h.

Referenced by beginRun().

std::string DTtTrigDBValidation::labelDBRef_
private

Definition at line 44 of file DTtTrigDBValidation.h.

Referenced by beginRun().

int DTtTrigDBValidation::lowerLimit_
private

Definition at line 47 of file DTtTrigDBValidation.h.

Referenced by beginRun().

std::string DTtTrigDBValidation::metname_
private

Definition at line 42 of file DTtTrigDBValidation.h.

Referenced by beginRun(), bookHistos(), and DTtTrigDBValidation().

std::string DTtTrigDBValidation::outputFileName_
private

Definition at line 52 of file DTtTrigDBValidation.h.

Referenced by DTtTrigDBValidation(), and endJob().

bool DTtTrigDBValidation::outputMEsInRootFile_
private

Definition at line 51 of file DTtTrigDBValidation.h.

Referenced by DTtTrigDBValidation(), and endJob().

std::map<std::pair<int,int>, MonitorElement* > DTtTrigDBValidation::tTrigDiffHistos_
private

Definition at line 63 of file DTtTrigDBValidation.h.

Referenced by beginRun(), and bookHistos().

std::map<int, MonitorElement* > DTtTrigDBValidation::tTrigDiffWheel_
private

Definition at line 64 of file DTtTrigDBValidation.h.

Referenced by beginRun(), and bookHistos().

std::map<DTSuperLayerId, std::pair<float,float> > DTtTrigDBValidation::tTrigMap_
private

Definition at line 60 of file DTtTrigDBValidation.h.

Referenced by beginRun().

std::map<DTSuperLayerId, std::pair<float,float> > DTtTrigDBValidation::tTrigRefMap_
private

Definition at line 59 of file DTtTrigDBValidation.h.

Referenced by beginRun().