CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SamplingHistograms.cc
Go to the documentation of this file.
9 #include <iostream>
10 #include <sstream>
11 #include <iomanip>
12 #include "TProfile.h"
13 
14 using namespace std;
15 using namespace sistrip;
16 
17 // -----------------------------------------------------------------------------
20  DQMStore* bei,
21  const sistrip::RunType& task )
22  : CommissioningHistograms( pset.getParameter<edm::ParameterSet>("SamplingParameters"),
23  bei,
24  task ),
25  sOnCut_(3)
26 {
28  << "[SamplingHistograms::" << __func__ << "]"
29  << " Constructing object...";
30  factory_ = auto_ptr<SamplingSummaryFactory>( new SamplingSummaryFactory );
31  // retreive the latency code from the root file
32  std::string dataPath = std::string(sistrip::collate_) + "/" + sistrip::root_ + "/latencyCode";
33  MonitorElement* codeElement = bei->get(dataPath);
34  if(codeElement) latencyCode_ = codeElement->getIntValue() ;
35  else latencyCode_ = 0;
36 }
37 
38 // -----------------------------------------------------------------------------
42  << "[SamplingHistograms::" << __func__ << "]"
43  << " Deleting object...";
44 }
45 
46 // -----------------------------------------------------------------------------
49 
50  // Clear map holding analysis objects
51  Analyses::iterator ianal;
52  for ( ianal = data().begin(); ianal != data().end(); ianal++ ) {
53  if ( ianal->second ) { delete ianal->second; }
54  }
55  data().clear();
56 
57  // Iterate through map containing vectors of profile histograms
58  HistosMap::const_iterator iter = histos().begin();
59  for ( ; iter != histos().end(); iter++ ) {
60  // Check vector of histos is not empty (should be 1 histo)
61  if ( iter->second.empty() ) {
63  << "[SamplingHistograms::" << __func__ << "]"
64  << " Zero collation histograms found!";
65  continue;
66  }
67 
68  // Retrieve pointers to profile histos for this FED channel
69  vector<TH1*> profs;
70  Histos::const_iterator ihis = iter->second.begin();
71  for ( ; ihis != iter->second.end(); ihis++ ) {
72  TProfile* prof = ExtractTObject<TProfile>().extract( (*ihis)->me_ );
73  if ( prof ) { profs.push_back(prof); }
74  }
75 
76  // Perform histo analysis
77  SamplingAnalysis* anal = new SamplingAnalysis( iter->first );
78  anal->setSoNcut(sOnCut_);
79  SamplingAlgorithm algo( this->pset(), anal, latencyCode_ );
80  algo.analysis( profs );
81  data()[iter->first] = anal;
82 
83  }
84 
85 }
86 
88 {
89  //TODO: should use the parameter set. Why is this crashing ???
90 // sOnCut_ = pset.getParameter<double>("SignalToNoiseCut");
91  sOnCut_ = 3.;
92 }
93 
void analysis(const std::vector< TH1 * > &)
Analysis for latency run.
SamplingHistograms(const edm::ParameterSet &pset, DQMStore *, const sistrip::RunType &task=sistrip::APV_LATENCY)
Algorithm for latency run.
const edm::ParameterSet & pset() const
void setSoNcut(const float sOnCut)
static const char mlDqmClient_[]
void histoAnalysis(bool debug)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1473
#define LogTrace(id)
int extract(std::vector< int > *output, const std::string &dati)
int64_t getIntValue(void) const
std::auto_ptr< Factory > factory_
#define begin
Definition: vmac.h:31
virtual void configure(const edm::ParameterSet &, const edm::EventSetup &)
static const char root_[]
#define debug
Definition: MEtoEDMFormat.h:34
static const char collate_[]
const HistosMap & histos() const