CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
APVValidationPlots Class Reference
Inheritance diagram for APVValidationPlots:
edm::EDAnalyzer edm::EDConsumerBase

Public Types

typedef dqm::legacy::DQMStore DQMStore
 
typedef dqm::legacy::MonitorElement MonitorElement
 
- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

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

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

Private Attributes

const std::string infilename
 
const std::string outfilename
 

Additional Inherited Members

- 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
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

Definition at line 40 of file APVValidationPlots.cc.

Member Typedef Documentation

Definition at line 42 of file APVValidationPlots.cc.

Definition at line 43 of file APVValidationPlots.cc.

Constructor & Destructor Documentation

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

Definition at line 68 of file APVValidationPlots.cc.

69  : infilename(iConfig.getUntrackedParameter<std::string>("inputFilename", "in.root")),
70  outfilename(iConfig.getUntrackedParameter<std::string>("outputFilename", "out.root"))
71 
72 {
73  //now do what ever initialization is needed
74 }
const std::string infilename
T getUntrackedParameter(std::string const &, T const &) const
const std::string outfilename

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 81 of file APVValidationPlots.cc.

81 {}
void APVValidationPlots::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 84 of file APVValidationPlots.cc.

References dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::DQMStore::cd(), dqm::legacy::MonitorElement::getTH1F(), dqm::legacy::MonitorElement::getTH2F(), mps_fire::i, timingPdfMaker::infile, infilename, dqmiolumiharvest::j, phase1PixelTopology::layer, phase1PixelTopology::layerName, Utilities::operator, outfilename, dqm::implementation::DQMStore::save(), dqm::implementation::DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and createJobs::tmp.

84  {
85  std::ostringstream oss;
86  oss << 1; //runNumber
87 
88  DQMStore* dqmStore = edm::Service<DQMStore>().operator->();
89  dqmStore->setCurrentFolder("ChannelStatusPlots");
90 
91  // Initialize histograms
92  std::vector<std::string> subDetName;
93  std::vector<unsigned int> nLayers;
94  std::vector<std::string> layerName;
95  subDetName.push_back("");
96  subDetName.push_back("TIB");
97  subDetName.push_back("TID");
98  subDetName.push_back("TOB");
99  subDetName.push_back("TEC");
100  nLayers.push_back(0);
101  nLayers.push_back(4);
102  nLayers.push_back(3);
103  nLayers.push_back(6);
104  nLayers.push_back(9);
105  layerName.push_back("");
106  layerName.push_back("Layer");
107  layerName.push_back("Disk");
108  layerName.push_back("Layer");
109  layerName.push_back("Disk");
110 
111  std::string histoName;
112  std::string histoTitle;
113  // Histograms
114  // indexes in these arrays are [SubDetId-2][LayerN]
115  // histograms for [SubDetId-2][0] are global for the subdetector
116  // histogram for [0][0] is global for the tracker
117  TH2F* medianVsAbsoluteOccupancy[5][10];
118  TH1F* medianOccupancy[5][10];
119  TH1F* absoluteOccupancy[5][10];
120  for (unsigned int i = 0; i < subDetName.size(); i++) {
121  for (unsigned int j = 0; j <= nLayers[i]; j++) {
122  histoName = "medianVsAbsoluteOccupancy" + subDetName[i];
123  if (j != 0) {
124  oss.str("");
125  oss << j;
126  histoName += layerName[i] + oss.str();
127  }
128  histoTitle = "Median APV occupancy vs. absolute APV occupancy";
129  if (i != 0)
130  histoTitle += " in " + subDetName[i];
131  if (j != 0) {
132  histoTitle += " " + layerName[i] + " " + oss.str();
133  }
134  MonitorElement* tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6., 1000, -1., 3.);
135  medianVsAbsoluteOccupancy[i][j] = tmp->getTH2F();
136  medianVsAbsoluteOccupancy[i][j]->Rebin2D(10, 10);
137  medianVsAbsoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Abs. Occupancy)");
138  medianVsAbsoluteOccupancy[i][j]->GetYaxis()->SetTitle("log_{10}(Median Occupancy)");
139  //
140  histoName = "medianOccupancy" + subDetName[i];
141  if (j != 0) {
142  oss.str("");
143  oss << j;
144  histoName += layerName[i] + oss.str();
145  }
146  histoTitle = "Median APV occupancy";
147  if (i != 0)
148  histoTitle += " in " + subDetName[i];
149  if (j != 0) {
150  histoTitle += " " + layerName[i] + " " + oss.str();
151  }
152  tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -1., 3.);
153  medianOccupancy[i][j] = tmp->getTH1F();
154  medianOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
155  medianOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
156  //
157  histoName = "absoluteOccupancy" + subDetName[i];
158  if (j != 0) {
159  oss.str("");
160  oss << j;
161  histoName += layerName[i] + oss.str();
162  }
163  histoTitle = "Absolute APV occupancy";
164  if (i != 0)
165  histoTitle += " in " + subDetName[i];
166  if (j != 0) {
167  histoTitle += " " + layerName[i] + " " + oss.str();
168  }
169  tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6.);
170  absoluteOccupancy[i][j] = tmp->getTH1F();
171  absoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
172  absoluteOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
173  }
174  }
175 
176  TFile* infile = new TFile(infilename.c_str(), "READ");
177  TTree* intree = (TTree*)infile->Get("moduleOccupancy");
178 
179  // Declaration of leaf types
180  Int_t DetRawId;
181  Int_t SubDetId;
182  Int_t Layer_Ring;
183  Int_t Disc;
184  Int_t IsBack;
185  Int_t IsExternalString;
186  Int_t IsZMinusSide;
187  Int_t RodStringPetal;
188  Int_t IsStereo;
189  Int_t ModulePosition;
190  Int_t NumberOfStrips;
191  Float_t APVGlobalPositionX;
192  Float_t APVGlobalPositionY;
193  Float_t APVGlobalPositionZ;
194  Int_t APVNumber;
195  Int_t APVAbsoluteOccupancy;
196  Double_t APVMedianOccupancy;
197  intree->SetBranchAddress("DetRawId", &DetRawId);
198  intree->SetBranchAddress("SubDetId", &SubDetId);
199  intree->SetBranchAddress("Layer_Ring", &Layer_Ring);
200  intree->SetBranchAddress("Disc", &Disc);
201  intree->SetBranchAddress("IsBack", &IsBack);
202  intree->SetBranchAddress("IsExternalString", &IsExternalString);
203  intree->SetBranchAddress("IsZMinusSide", &IsZMinusSide);
204  intree->SetBranchAddress("RodStringPetal", &RodStringPetal);
205  intree->SetBranchAddress("IsStereo", &IsStereo);
206  intree->SetBranchAddress("ModuleNumber", &ModulePosition);
207  intree->SetBranchAddress("NumberOfStrips", &NumberOfStrips);
208  intree->SetBranchAddress("APVGlobalPositionX", &APVGlobalPositionX);
209  intree->SetBranchAddress("APVGlobalPositionY", &APVGlobalPositionY);
210  intree->SetBranchAddress("APVGlobalPositionZ", &APVGlobalPositionZ);
211  intree->SetBranchAddress("APVNumber", &APVNumber);
212  intree->SetBranchAddress("APVAbsoluteOccupancy", &APVAbsoluteOccupancy);
213  intree->SetBranchAddress("APVMedianOccupancy", &APVMedianOccupancy);
214 
215  for (int i = 0; i < intree->GetEntries(); i++) {
216  intree->GetEntry(i);
217 
218  double logMedianOccupancy = -1;
219  double logAbsoluteOccupancy = -1;
220 
221  if (APVMedianOccupancy > 0)
222  logMedianOccupancy = log10(APVMedianOccupancy);
223  if (APVAbsoluteOccupancy > 0)
224  logAbsoluteOccupancy = log10(APVAbsoluteOccupancy);
225 
226  // The layer/disk information is stored in Layer_Ring for TIB/TOB and in Disc for TID/TEC
227  unsigned int layer = 0;
228  if (SubDetId == 3 || SubDetId == 5)
229  layer = Layer_Ring;
230  else
231  layer = Disc;
232 
233  // Fill histograms for all the tracker
234  medianVsAbsoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy, logMedianOccupancy);
235  medianOccupancy[0][0]->Fill(logMedianOccupancy);
236  absoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy);
237  // Fill summary histograms for each subdetector
238  medianVsAbsoluteOccupancy[SubDetId - 2][0]->Fill(logAbsoluteOccupancy, logMedianOccupancy);
239  medianOccupancy[SubDetId - 2][0]->Fill(logMedianOccupancy);
240  absoluteOccupancy[SubDetId - 2][0]->Fill(logAbsoluteOccupancy);
241  // Fill histograms for each layer/disk
242  medianVsAbsoluteOccupancy[SubDetId - 2][layer]->Fill(logAbsoluteOccupancy, logMedianOccupancy);
243  medianOccupancy[SubDetId - 2][layer]->Fill(logMedianOccupancy);
244  absoluteOccupancy[SubDetId - 2][layer]->Fill(logAbsoluteOccupancy);
245  }
246 
247  dqmStore->cd();
248  dqmStore->save(outfilename, "ChannelStatusPlots");
249 }
const std::string infilename
virtual TH2F * getTH2F() const
constexpr char const * layerName[numberOfLayers]
virtual TH1F * getTH1F() const
const std::string outfilename
constexpr std::array< uint8_t, layerIndexSize > layer
tmp
align.sh
Definition: createJobs.py:716

Member Data Documentation

const std::string APVValidationPlots::infilename
private

Definition at line 51 of file APVValidationPlots.cc.

Referenced by endJob().

const std::string APVValidationPlots::outfilename
private

Definition at line 52 of file APVValidationPlots.cc.

Referenced by endJob().