11 #include <arpa/inet.h>
12 #include <sys/unistd.h>
13 #include <sys/socket.h>
28 nBins_(65),lastCalChan_(8),
32 LogDebug(
"Commissioning") <<
"[CalibrationTask::CalibrationTask] Constructing object...";
38 int stop = start + 256;
41 for(
int strip = start; strip < stop; ++strip) {
42 value = int(pedestalsHandle->getPed(strip,detPedRange));
43 if(value>895) value -= 1024;
51 LogDebug(
"Commissioning") <<
"[CalibrationTask::CalibrationTask] Destructing object...";
57 LogDebug(
"Commissioning") <<
"[CalibrationTask::book]";
61 for(
int apv=0;apv<2;++apv) {
62 for(
int i=0;
i<16;++
i) {
69 std::stringstream complement;
70 complement <<
"_" <<
i ;
71 title += complement.str();
73 calib_[apv*16+
i].isProfile_=
false;
82 std::vector<std::string> existingMEs =
dqm()->
getMEs();
83 if(
find(existingMEs.begin(),existingMEs.end(),
"calchan")!=existingMEs.end()) {
90 LogDebug(
"Commissioning") <<
"[CalibrationTask::book] done";
98 LogDebug(
"Commissioning") <<
"[CalibrationTask::fill]";
100 int isub,ical = summary.
calChan();
101 isub = ical<4 ? ical+4 : ical-4;
108 for (
int apv=0; apv<2; ++apv) {
109 for (
int k=0;
k<16;++
k) {
120 for(std::vector<HistoSet>::iterator it=
calib_.begin();it<
calib_.end();++it) {
144 for(
int apv=0;apv<2;++apv) {
145 for(
int i=0;
i<16;++
i) {
146 std::stringstream complement;
154 complement.str() ).
title();
155 calib_[apv*16+
i].histo()->setTitle(title);
156 calib_[apv*16+
i].histo()->setAxisTitle(title);
168 if ( getenv(scratch.c_str()) !=
NULL ) {
169 dir = getenv(scratch.c_str());
173 std::stringstream
ss;
174 if ( !dir.empty() ) { ss << dir <<
"/"; }
175 else { ss <<
"/tmp/"; }
185 <<
"[SiStripCommissioningSource::" << __func__ <<
"]"
186 <<
" Saved all histograms to file \""
190 <<
"[SiStripCommissioningSource::" << __func__ <<
"]"
191 <<
" Skipping creation of file \""
192 << ss.str() <<
"\" that already exists" ;
196 <<
"[SiStripCommissioningSource::" << __func__ <<
"]"
197 <<
" NULL value for filename! No root file saved!";
201 for(std::vector<HistoSet>::iterator it=
calib_.begin();it<
calib_.end();++it) {
202 it->vNumOfEntries_.clear();
203 it->vNumOfEntries_.resize(
nBins_,0);
206 lastCalChan_ = calchan;
218 gethostname( hn,
sizeof(hn) );
220 he = gethostbyname(hn);
227 host_ip =
std::string( inet_ntoa( *(
struct in_addr*)(he->h_addr) ) );
229 host_name =
"unknown.cern.ch";
230 host_ip =
"255.255.255.255";
235 std::stringstream ip;
237 while ( pos != std::string::npos ) {
239 if ( tmp != std::string::npos ) {
242 << host_ip.substr( pos, tmp-pos )
248 << host_ip.substr( pos );
249 pos = std::string::npos;
254 pid_t
pid = getpid();
tuple start
Check for commandline option errors.
Utility class that holds histogram title.
const std::string & title() const
const uint32_t & latency() const
uint16_t apvPairNumber() const
std::pair< ContainerIterator, ContainerIterator > Range
CalibrationTask(DQMStore *, const FedChannelConnection &, const sistrip::RunType &, const char *filename, uint32_t run, const edm::EventSetup &setup)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void directory(std::stringstream &, uint32_t run_number=0)
void updateHistoSet(HistoSet &, const uint32_t &bin, const float &value)
const uint32_t & detId() const
Class containning control, module, detector and connection information, at the level of a FED channel...
sistrip::RunType runType_
virtual void fill(const SiStripEventSummary &, const edm::DetSet< SiStripRawDigi > &)
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. "my/long/dir/my_histo")
const uint32_t & calSel() const
std::vector< uint16_t > ped
DQMStore *const dqm() const
std::vector< std::string > getMEs(void) const
get list of (non-dir) MEs of current directory
std::vector< std::vector< double > > tmp
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)
static const char root_[]
const uint32_t & calChan() const
const FedChannelConnection & connection() const
MonitorElement * bookInt(const char *name)
Book int.
virtual ~CalibrationTask()
MonitorElement * calchanElement_
std::vector< HistoSet > calib_
void setCurrentFolder(const std::string &fullpath)
void checkAndSave(const uint16_t &)
const std::string & pwd(void) const