CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
ApvTimingHistograms Class Reference

#include <ApvTimingHistograms.h>

Inheritance diagram for ApvTimingHistograms:
CommissioningHistograms ApvTimingHistosUsingDb

Public Member Functions

 ApvTimingHistograms (const edm::ParameterSet &pset, DQMStore *)
 
void histoAnalysis (bool debug)
 
virtual ~ApvTimingHistograms ()
 
- Public Member Functions inherited from CommissioningHistograms
 CommissioningHistograms (const edm::ParameterSet &pset, DQMStore *const, const sistrip::RunType &)
 
 CommissioningHistograms ()
 
virtual void configure (const edm::ParameterSet &, const edm::EventSetup &)
 
void createCollations (const std::vector< std::string > &)
 
virtual void createSummaryHisto (const sistrip::Monitorable &, const sistrip::Presentation &, const std::string &top_level_dir, const sistrip::Granularity &)
 
void extractHistograms (const std::vector< std::string > &)
 
virtual void printAnalyses ()
 
virtual void printSummary ()
 
void remove (std::string pattern="")
 
void save (std::string &filename, uint32_t run_number=0)
 
virtual ~CommissioningHistograms ()
 

Additional Inherited Members

- Public Types inherited from CommissioningHistograms
typedef std::map< uint32_t,
CommissioningAnalysis * > 
Analyses
 
typedef Analyses::iterator Analysis
 
typedef SummaryPlotFactory
< CommissioningAnalysis * > 
Factory
 
typedef std::map< uint32_t,
uint32_t > 
FedToFecMap
 
typedef std::vector< Histo * > Histos
 
typedef std::map< uint32_t,
Histos
HistosMap
 
- Static Public Member Functions inherited from CommissioningHistograms
static void copyCustomInformation (DQMStore *const, const std::vector< std::string > &)
 
static void getContents (DQMStore *const, std::vector< std::string > &)
 
static uint32_t runNumber (DQMStore *const, const std::vector< std::string > &)
 
static sistrip::RunType runType (DQMStore *const, const std::vector< std::string > &)
 
- Protected Member Functions inherited from CommissioningHistograms
DQMStore *const bei () const
 
void clearHistosMap ()
 
Analysesdata ()
 
Factory *const factory ()
 
TH1 * histogram (const sistrip::Monitorable &, const sistrip::Presentation &, const sistrip::View &, const std::string &directory, const uint32_t &xbins, const float &xlow=1.*sistrip::invalid_, const float &xhigh=1.*sistrip::invalid_)
 
const HistosMaphistos () const
 
const FedToFecMapmapping () const
 
void printHistosMap ()
 
const edm::ParameterSetpset () const
 
const sistrip::RunTypetask () const
 
- Protected Attributes inherited from CommissioningHistograms
std::auto_ptr< Factoryfactory_
 

Detailed Description

Definition at line 8 of file ApvTimingHistograms.h.

Constructor & Destructor Documentation

ApvTimingHistograms::ApvTimingHistograms ( const edm::ParameterSet pset,
DQMStore bei 
)

Definition at line 18 of file ApvTimingHistograms.cc.

References CommissioningHistograms::factory_, LogTrace, and sistrip::mlDqmClient_.

20  : CommissioningHistograms( pset.getParameter<edm::ParameterSet>("ApvTimingParameters"),
21  bei,
23 {
24  factory_ = auto_ptr<ApvTimingSummaryFactory>( new ApvTimingSummaryFactory );
26  << "[ApvTimingHistograms::" << __func__ << "]"
27  << " Constructing object...";
28 }
T getParameter(std::string const &) const
static const char mlDqmClient_[]
#define LogTrace(id)
std::auto_ptr< Factory > factory_
DQMStore *const bei() const
ApvTimingHistograms::~ApvTimingHistograms ( )
virtual

Definition at line 32 of file ApvTimingHistograms.cc.

References LogTrace, and sistrip::mlDqmClient_.

32  {
34  << "[ApvTimingHistograms::" << __func__ << "]"
35  << " Destructing object...";
36 }
static const char mlDqmClient_[]
#define LogTrace(id)

Member Function Documentation

void ApvTimingHistograms::histoAnalysis ( bool  debug)
virtual

Reimplemented from CommissioningHistograms.

Definition at line 40 of file ApvTimingHistograms.cc.

References ecalcalib_dqm_sourceclient-live_cfg::algo, CommissioningAlgorithm::analysis(), begin, SiStripFecKey::ccuAddr(), SiStripFecKey::ccuChan(), prof2calltree::count, CommissioningHistograms::data(), relativeConstraints::empty, benchmark_cfg::errors, extract(), SiStripFecKey::fecCrate(), SiStripFecKey::fecRing(), SiStripFecKey::fecSlot(), ApvTimingAnalysis::foundTickMark(), CommissioningAnalysis::getErrorCodes(), CommissioningHistograms::histos(), cuy::ii, sistrip::invalid_, ApvTimingAnalysis::isValid(), getDQMSummary::iter, SiStripFecKey::lldChan(), LogTrace, bookConverter::max, min(), sistrip::mlDqmClient_, CommissioningHistograms::pset(), ApvTimingAnalysis::refTime(), contentValuesCheck::ss, ApvTimingAnalysis::time(), TrackValidation_HighPurity_cff::valid, and sistrip::valid_.

40  {
42  << "[ApvTimingHistograms::" << __func__ << "]";
43 
44  // Some initialisation
45  uint16_t valid = 0;
46  HistosMap::const_iterator iter;
47  Analyses::iterator ianal;
48  std::map<std::string,uint16_t> errors;
49 
50  // Clear map holding analysis objects
51  for ( ianal = data().begin(); ianal != data().end(); ianal++ ) {
52  if ( ianal->second ) { delete ianal->second; }
53  }
54  data().clear();
55 
56  // Reset minimum / maximum delays
57  float time_min = 1. * sistrip::invalid_;
58  float time_max = -1. * sistrip::invalid_;
59  uint32_t device_min = sistrip::invalid_;
60  uint32_t device_max = sistrip::invalid_;
61 
62  // Iterate through map containing histograms
63  for ( iter = histos().begin();
64  iter != histos().end(); iter++ ) {
65 
66  // Check vector of histos is not empty
67  if ( iter->second.empty() ) {
69  << "[ApvTimingHistograms::" << __func__ << "]"
70  << " Zero histograms found!";
71  continue;
72  }
73 
74  // Retrieve pointers to histos
75  std::vector<TH1*> profs;
76  Histos::const_iterator ihis = iter->second.begin();
77  for ( ; ihis != iter->second.end(); ihis++ ) {
78  TProfile* prof = ExtractTObject<TProfile>().extract( (*ihis)->me_ );
79  if ( prof ) { profs.push_back(prof); }
80  }
81 
82  // Perform histo analysis
83  ApvTimingAnalysis* anal = new ApvTimingAnalysis( iter->first );
84  ApvTimingAlgorithm algo( this->pset(), anal );
85  algo.analysis( profs );
86  data()[iter->first] = anal;
87 
88  // Check if tick mark found
89  if ( !anal->foundTickMark() ) { continue; }
90 
91  // Find maximum time
92  if ( anal->time() > time_max ) {
93  time_max = anal->time();
94  device_max = iter->first;
95  }
96 
97  // Find minimum time
98  if ( anal->time() < time_min ) {
99  time_min = anal->time();
100  device_min = iter->first;
101  }
102 
103  }
104 
105  // Adjust maximum (and minimum) delay(s) to find optimum sampling point(s)
106  if ( time_max > sistrip::valid_ ||
107  time_max < -1.*sistrip::valid_ ) {
108 
110  << "[ApvTimingHistograms::" << __func__ << "]"
111  << " Unable to set maximum time! Found unexpected value: "
112  << time_max;
113 
114  } else {
115 
116  SiStripFecKey min( device_min );
118  << "[ApvTimingHistograms::" << __func__ << "]"
119  << " Crate/FEC/Ring/CCU/module/channel: "
120  << min.fecCrate() << "/"
121  << min.fecSlot() << "/"
122  << min.fecRing() << "/"
123  << min.ccuAddr() << "/"
124  << min.ccuChan() << "/"
125  << min.lldChan()
126  << " has minimum time for tick mark rising edge [ns]: " << time_min;
127 
128  SiStripFecKey max( device_max );
130  << "[ApvTimingHistograms::" << __func__ << "]"
131  << " Crate/FEC/Ring/CCU/module/channel: "
132  << max.fecCrate() << "/"
133  << max.fecSlot() << "/"
134  << max.fecRing() << "/"
135  << max.ccuAddr() << "/"
136  << max.ccuChan() << "/"
137  << max.lldChan()
138  << " has maximum time for tick mark rising edge [ns]: " << time_max;
139 
141  << "[ApvTimingHistograms::" << __func__ << "]"
142  << " Difference b/w minimum and maximum times"
143  << " for tick mark rising edges [ns] is: " << ( time_max - time_min );
144 
145  }
146 
147  // Set reference time for all analysis objects
148  for ( ianal = data().begin(); ianal != data().end(); ianal++ ) {
149  ApvTimingAnalysis* anal = dynamic_cast<ApvTimingAnalysis*>(ianal->second);
150  if ( !anal ) { continue; }
151  anal->refTime( time_max, this->pset().getParameter<int>("TargetDelay") );
152  if ( anal->isValid() ) { valid++; }
153  if ( !anal->getErrorCodes().empty() ) {
154  errors[anal->getErrorCodes()[0]]++;
155  }
156  }
157 
158  if ( !histos().empty() ) {
160  << "[ApvTimingHistograms::" << __func__ << "]"
161  << " Analyzed histograms for " << histos().size()
162  << " FED channels, of which " << valid
163  << " (" << 100 * valid / histos().size()
164  << "%) are valid.";
165  } else {
167  << "[ApvTimingHistograms::" << __func__ << "]"
168  << " No histograms to analyze!";
169  }
170 
171  if ( !histos().empty() ) {
173  << "[ApvTimingHistograms::" << __func__ << "]"
174  << " Analyzed histograms for " << histos().size()
175  << " FED channels, of which " << valid
176  << " (" << 100 * valid / histos().size()
177  << "%) are valid.";
178  if ( !errors.empty() ) {
179  uint16_t count = 0;
180  std::stringstream ss;
181  ss << std::endl;
182  std::map<std::string,uint16_t>::const_iterator ii;
183  for ( ii = errors.begin(); ii != errors.end(); ++ii ) {
184  ss << " " << ii->first << ": " << ii->second << std::endl;
185  count += ii->second;
186  }
188  << "[ApvTimingHistograms::" << __func__ << "]"
189  << " Found " << count << " errors ("
190  << 100 * count / histos().size() << "%): "
191  << ss.str();
192  }
193  } else {
195  << "[ApvTimingHistograms::" << __func__ << "]"
196  << " No histograms to analyze!";
197  }
198 
199 }
const edm::ParameterSet & pset() const
const float & refTime() const
Analysis for timing run using APV tick marks.
static const char mlDqmClient_[]
static const uint16_t valid_
Definition: Constants.h:17
int ii
Definition: cuy.py:588
Utility class that identifies a position within the strip tracker control structure, down to the level of an APV25.
Definition: SiStripFecKey.h:45
T min(T a, T b)
Definition: MathUtil.h:58
const float & time() const
#define LogTrace(id)
int extract(std::vector< int > *output, const std::string &dati)
static const uint16_t invalid_
Definition: Constants.h:16
#define begin
Definition: vmac.h:30
Analysis for timing run using APV tick marks.
const VString & getErrorCodes() const
bool foundTickMark() const
const HistosMap & histos() const