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
APVValidationPlots Class Reference
Inheritance diagram for APVValidationPlots:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 APVValidationPlots (const edm::ParameterSet &)
 
 ~APVValidationPlots ()
 
- 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

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void endJob () override
 

Private Attributes

TH1F * absoluteOccupancy [5][10]
 
Int_t APVAbsoluteOccupancy
 
Float_t APVGlobalPositionX
 
Float_t APVGlobalPositionY
 
Float_t APVGlobalPositionZ
 
Double_t APVMedianOccupancy
 
Int_t APVNumber
 
Int_t DetRawId
 
Int_t Disc
 
DQMStoredqmStore
 
TFile * infile
 
std::string infilename
 
TTree * intree
 
Int_t IsBack
 
Int_t IsExternalString
 
Int_t IsStereo
 
Int_t IsZMinusSide
 
Int_t Layer_Ring
 
std::vector< std::string > layerName
 
TH1F * medianOccupancy [5][10]
 
TH2F * medianVsAbsoluteOccupancy [5][10]
 
Int_t ModulePosition
 
std::vector< unsigned int > nLayers
 
Int_t NumberOfStrips
 
std::ostringstream oss
 
std::string outfilename
 
Int_t RodStringPetal
 
Int_t SubDetId
 
std::vector< std::string > subDetName
 
MonitorElementtmp
 

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 41 of file APVValidationPlots.cc.

Constructor & Destructor Documentation

APVValidationPlots::APVValidationPlots ( const edm::ParameterSet iConfig)
explicit

Definition at line 112 of file APVValidationPlots.cc.

112  : infilename(iConfig.getUntrackedParameter<std::string>("inputFilename","in.root")),
113  outfilename(iConfig.getUntrackedParameter<std::string>("outputFilename","out.root"))
114 
115 {
116  //now do what ever initialization is needed
117 
118 }
T getUntrackedParameter(std::string const &, T const &) const
APVValidationPlots::~APVValidationPlots ( )

Definition at line 121 of file APVValidationPlots.cc.

122 {
123 
124  // do anything here that needs to be done at desctruction time
125  // (e.g. close files, deallocate resources etc.)
126 
127 }

Member Function Documentation

void APVValidationPlots::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 136 of file APVValidationPlots.cc.

137 {
138 
139 }
void APVValidationPlots::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 144 of file APVValidationPlots.cc.

References absoluteOccupancy, DQMStore::book1D(), DQMStore::book2D(), dqmStore, MonitorElement::getTH1F(), MonitorElement::getTH2F(), hltbtagharvestinganalyzer_cfi::histoName, i, j, layerName, medianOccupancy, medianVsAbsoluteOccupancy, nLayers, cppFunctionSkipper::operator, oss, DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, subDetName, and tmp.

145 {
146  oss.str("");
147  oss << 1; //runNumber
148 
150  dqmStore->setCurrentFolder("ChannelStatusPlots");
151 
152  // Initialize histograms
153  subDetName.push_back(""); subDetName.push_back("TIB"); subDetName.push_back("TID"); subDetName.push_back("TOB"); subDetName.push_back("TEC");
154  nLayers.push_back(0); nLayers.push_back(4); nLayers.push_back(3); nLayers.push_back(6); nLayers.push_back(9);
155  layerName.push_back(""); layerName.push_back("Layer"); layerName.push_back("Disk"); layerName.push_back("Layer"); layerName.push_back("Disk");
156 
158  std::string histoTitle;
159  for(unsigned int i = 0; i < subDetName.size(); i++)
160  {
161  for(unsigned int j = 0; j <= nLayers[i]; j++)
162  {
163  histoName = "medianVsAbsoluteOccupancy" + subDetName[i];
164  if(j!=0)
165  {
166  oss.str("");
167  oss << j;
168  histoName += layerName[i] + oss.str();
169  }
170  histoTitle = "Median APV occupancy vs. absolute APV occupancy";
171  if(i!=0)
172  histoTitle += " in " + subDetName[i];
173  if(j!=0)
174  {
175  histoTitle += " " + layerName[i] + " " + oss.str();
176  }
177  tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6., 1000, -1., 3.);
179  medianVsAbsoluteOccupancy[i][j]->Rebin2D(10,10);
180  medianVsAbsoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Abs. Occupancy)");
181  medianVsAbsoluteOccupancy[i][j]->GetYaxis()->SetTitle("log_{10}(Median Occupancy)");
182  //
183  histoName = "medianOccupancy" + subDetName[i];
184  if(j!=0)
185  {
186  oss.str("");
187  oss << j;
188  histoName += layerName[i] + oss.str();
189  }
190  histoTitle = "Median APV occupancy";
191  if(i!=0)
192  histoTitle += " in " + subDetName[i];
193  if(j!=0)
194  {
195  histoTitle += " " + layerName[i] + " " + oss.str();
196  }
197  tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -1., 3.);
198  medianOccupancy[i][j] = tmp->getTH1F();
199  medianOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
200  medianOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
201  //
202  histoName = "absoluteOccupancy" + subDetName[i];
203  if(j!=0)
204  {
205  oss.str("");
206  oss << j;
207  histoName += layerName[i] + oss.str();
208  }
209  histoTitle = "Absolute APV occupancy";
210  if(i!=0)
211  histoTitle += " in " + subDetName[i];
212  if(j!=0)
213  {
214  histoTitle += " " + layerName[i] + " " + oss.str();
215  }
216  tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6.);
218  absoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
219  absoluteOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
220  }
221  }
222 
223 }
int i
Definition: DBlmapReader.cc:9
std::vector< std::string > subDetName
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:975
TH1F * medianOccupancy[5][10]
MonitorElement * tmp
TH2F * medianVsAbsoluteOccupancy[5][10]
std::ostringstream oss
int j
Definition: DBlmapReader.cc:9
std::vector< std::string > layerName
TH1F * getTH1F(void) const
std::vector< unsigned int > nLayers
TH2F * getTH2F(void) const
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:1103
TH1F * absoluteOccupancy[5][10]
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:688
void APVValidationPlots::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 227 of file APVValidationPlots.cc.

References absoluteOccupancy, APVAbsoluteOccupancy, APVGlobalPositionX, APVGlobalPositionY, APVGlobalPositionZ, APVMedianOccupancy, APVNumber, DQMStore::cd(), DetRawId, Disc, dqmStore, i, infile, infilename, intree, IsBack, IsExternalString, IsStereo, IsZMinusSide, Layer_Ring, medianOccupancy, medianVsAbsoluteOccupancy, ModulePosition, NumberOfStrips, outfilename, RodStringPetal, DQMStore::save(), and SubDetId.

227  {
228 
229  infile = new TFile(infilename.c_str(),"READ");
230  intree = (TTree*)infile->Get("moduleOccupancy");
231 
232  intree->SetBranchAddress("DetRawId", &DetRawId);
233  intree->SetBranchAddress("SubDetId", &SubDetId);
234  intree->SetBranchAddress("Layer_Ring", &Layer_Ring);
235  intree->SetBranchAddress("Disc", &Disc);
236  intree->SetBranchAddress("IsBack", &IsBack);
237  intree->SetBranchAddress("IsExternalString", &IsExternalString);
238  intree->SetBranchAddress("IsZMinusSide", &IsZMinusSide);
239  intree->SetBranchAddress("RodStringPetal", &RodStringPetal);
240  intree->SetBranchAddress("IsStereo", &IsStereo);
241  intree->SetBranchAddress("ModuleNumber", &ModulePosition);
242  intree->SetBranchAddress("NumberOfStrips", &NumberOfStrips);
243  intree->SetBranchAddress("APVGlobalPositionX", &APVGlobalPositionX);
244  intree->SetBranchAddress("APVGlobalPositionY", &APVGlobalPositionY);
245  intree->SetBranchAddress("APVGlobalPositionZ", &APVGlobalPositionZ);
246  intree->SetBranchAddress("APVNumber", &APVNumber);
247  intree->SetBranchAddress("APVAbsoluteOccupancy", &APVAbsoluteOccupancy);
248  intree->SetBranchAddress("APVMedianOccupancy", &APVMedianOccupancy);
249 
250  for (int i=0; i<intree->GetEntries(); i++)
251  {
252  intree->GetEntry(i);
253 
254  double logMedianOccupancy = -1;
255  double logAbsoluteOccupancy = -1;
256 
257  if (APVMedianOccupancy>0) logMedianOccupancy = log10(APVMedianOccupancy);
258  if (APVAbsoluteOccupancy>0) logAbsoluteOccupancy = log10(APVAbsoluteOccupancy);
259 
260  // The layer/disk information is stored in Layer_Ring for TIB/TOB and in Disc for TID/TEC
261  unsigned int layer = 0;
262  if(SubDetId==3 || SubDetId==5)
263  layer=Layer_Ring;
264  else
265  layer=Disc;
266 
267  // Fill histograms for all the tracker
268  medianVsAbsoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy,logMedianOccupancy);
269  medianOccupancy[0][0]->Fill(logMedianOccupancy);
270  absoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy);
271  // Fill summary histograms for each subdetector
272  medianVsAbsoluteOccupancy[SubDetId-2][0]->Fill(logAbsoluteOccupancy,logMedianOccupancy);
273  medianOccupancy[SubDetId-2][0]->Fill(logMedianOccupancy);
274  absoluteOccupancy[SubDetId-2][0]->Fill(logAbsoluteOccupancy);
275  // Fill histograms for each layer/disk
276  medianVsAbsoluteOccupancy[SubDetId-2][layer]->Fill(logAbsoluteOccupancy,logMedianOccupancy);
277  medianOccupancy[SubDetId-2][layer]->Fill(logMedianOccupancy);
278  absoluteOccupancy[SubDetId-2][layer]->Fill(logAbsoluteOccupancy);
279  }
280 
281  dqmStore->cd();
282  dqmStore->save(outfilename.c_str(),"ChannelStatusPlots");
283 
284 }
int i
Definition: DBlmapReader.cc:9
TH1F * medianOccupancy[5][10]
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:665
TH2F * medianVsAbsoluteOccupancy[5][10]
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:2566
TH1F * absoluteOccupancy[5][10]

Member Data Documentation

TH1F* APVValidationPlots::absoluteOccupancy[5][10]
private

Definition at line 65 of file APVValidationPlots.cc.

Referenced by beginJob(), and endJob().

Int_t APVValidationPlots::APVAbsoluteOccupancy
private

Definition at line 93 of file APVValidationPlots.cc.

Referenced by endJob().

Float_t APVValidationPlots::APVGlobalPositionX
private

Definition at line 89 of file APVValidationPlots.cc.

Referenced by endJob().

Float_t APVValidationPlots::APVGlobalPositionY
private

Definition at line 90 of file APVValidationPlots.cc.

Referenced by endJob().

Float_t APVValidationPlots::APVGlobalPositionZ
private

Definition at line 91 of file APVValidationPlots.cc.

Referenced by endJob().

Double_t APVValidationPlots::APVMedianOccupancy
private

Definition at line 94 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::APVNumber
private

Definition at line 92 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::DetRawId
private

Definition at line 78 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::Disc
private

Definition at line 81 of file APVValidationPlots.cc.

Referenced by endJob().

DQMStore* APVValidationPlots::dqmStore
private

Definition at line 54 of file APVValidationPlots.cc.

Referenced by beginJob(), and endJob().

TFile* APVValidationPlots::infile
private

Definition at line 74 of file APVValidationPlots.cc.

Referenced by endJob().

std::string APVValidationPlots::infilename
private

Definition at line 71 of file APVValidationPlots.cc.

Referenced by endJob().

TTree* APVValidationPlots::intree
private

Definition at line 75 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::IsBack
private

Definition at line 82 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::IsExternalString
private

Definition at line 83 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::IsStereo
private

Definition at line 86 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::IsZMinusSide
private

Definition at line 84 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::Layer_Ring
private

Definition at line 80 of file APVValidationPlots.cc.

Referenced by endJob().

std::vector<std::string> APVValidationPlots::layerName
private

Definition at line 69 of file APVValidationPlots.cc.

Referenced by beginJob().

TH1F* APVValidationPlots::medianOccupancy[5][10]
private

Definition at line 64 of file APVValidationPlots.cc.

Referenced by beginJob(), and endJob().

TH2F* APVValidationPlots::medianVsAbsoluteOccupancy[5][10]
private

Definition at line 63 of file APVValidationPlots.cc.

Referenced by beginJob(), and endJob().

Int_t APVValidationPlots::ModulePosition
private

Definition at line 87 of file APVValidationPlots.cc.

Referenced by endJob().

std::vector<unsigned int> APVValidationPlots::nLayers
private

Definition at line 68 of file APVValidationPlots.cc.

Referenced by beginJob().

Int_t APVValidationPlots::NumberOfStrips
private

Definition at line 88 of file APVValidationPlots.cc.

Referenced by endJob().

std::ostringstream APVValidationPlots::oss
private

Definition at line 52 of file APVValidationPlots.cc.

Referenced by beginJob().

std::string APVValidationPlots::outfilename
private

Definition at line 72 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::RodStringPetal
private

Definition at line 85 of file APVValidationPlots.cc.

Referenced by endJob().

Int_t APVValidationPlots::SubDetId
private

Definition at line 79 of file APVValidationPlots.cc.

Referenced by endJob().

std::vector<std::string> APVValidationPlots::subDetName
private

Definition at line 67 of file APVValidationPlots.cc.

Referenced by beginJob().

MonitorElement* APVValidationPlots::tmp
private

Definition at line 56 of file APVValidationPlots.cc.

Referenced by beginJob().