直方图C ++(根)代码中的错误 [英] Error in histogram C++ (root) code
问题描述
我在C ++(root)中有这行代码:
void TMTrackAnalyzer :: beginJob()
{
edm :: Service< TFileService> FS;
dirs_.insert(std :: pair< ObjectType,TFileDirectory *>(InputData,fs-> mkdir( InputData)));
}
基本上填充直方图,设置直方图,标签和标题的范围。实际上我在这个函数中填充了更多的直方图,但为了简单起见我只放了一个。对于他们每个人,我都会遇到这些错误:
预期在''之前的' - ''''''''''''''''''''''''''''''''''''''''''''''''''' '令牌
这些是指(和,在InputData之前和之后.InputData是我想要保存直方图的目录。有谁知道出了什么问题在这里?谢谢!
我的尝试:
我试图谷歌类似但没有找到任何东西,我不知道该怎么做
你的std :: pair
构造错误。您可能希望使用std :: make_pair
或在传递给dirs_.insert之前使用变量名明显地创建它
(未经测试):
std :: pair< ObjectType,TFileDirectory *> mypair(InputData,fs-> mkdir( InputData)));
dirs_.insert (mypair);
I have this line of code in C++ (root):
void TMTrackAnalyzer::beginJob()
{
edm::Service<TFileService> fs;
dirs_.insert(std::pair< ObjectType, TFileDirectory* >(InputData, fs->mkdir("InputData") ) );
}
which basically fills a histogram, sets the range of the histogram, label and title. Actually I fill more histograms in this function, but I put here just one for simplicity. And for each of them I get these errors:
expected primary-expression before '(' token
expected primary-expression before ',' token
These refer to the ( and , before and after InputData. InputData is the directory where I want to save the histograms. Do anyone has any idea what is wrong here? Thank you!
What I have tried:
I tried to google something similar but haven't found anything and I am not sure what to do
Yourstd::pair
construction is wrong. You probably want to usestd::make_pair
or create it explicitely using a variable name before passing todirs_.insert
(untested):
std::pair< ObjectType, TFileDirectory* > mypair (InputData, fs->mkdir("InputData") ) ); dirs_.insert(mypair);
See also pair::pair - C++ Reference[^].
这篇关于直方图C ++(根)代码中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!