About ROOT macro

1. warning: deprecated conversion from string constant to ‘char*’

  • Reason :
    char *stringA;stringA="PromptJPsi";
  • Solution :
    const char *stringA;stringA="PromptJPsi";

2. error: too few arguments to function ‘void FillDen1?(int, double, double)’

  • Reason : Define FillDen1?(int a, double b, double c), Call FillDen1?(int aa, double bb, double cc, float dd)
  • Solution : Correct definition or calling : Define FillDen1?(int a, double b, double c, double d), Call FillDen1?(int aa, double bb, double cc, float dd)

3.

 error: array bound is not an integer constant 

-> ?

4.

 error: cannot convert ‘Float_t’ to ‘double*’ for argument ‘3’ to ‘void FillNocu(double, double, double*)’ 

-> 함수에서 array를 호출할 때에는 배열 이름만 적어주고, 어느 부분을 호출하는지는 함수에서 밝힌다.

void FillNocu(double, double, double a[2][2]); 
a[2][2];
int main() {
   double a, b;double arr[2][2];
   FillNocu (a,b,arr);
}
void FillNocu(double, double, double a[2][2])
{
}
5. for 문은 함수 밖에서 쓸 수 없다?

6.

 Warning in <TFile::Append>: Replacing existing TH1: hNocuYPt_noweight (Potential memory leak). 

-> 같은 이름의 히스토그램을 또 부르면 안 된다.

7.

 Warning in <TH1F::Sumw2>: Sum of squares of weights structure already created 

-> Sumw2는 한번만 한다.

8.

 *** Break *** bus error

The lines below might hint at the cause of the crash.
If they do not help you then please submit a bug report at
http://root.cern.ch/bugs. Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
===========================================================
#6  0x03c09cc7 in FillDen1 ()
#7  0x03c1566c in Ana_20110501_onecode ()
===========================================================
-> bus error는 본함수와 서브함수, 함수 밖의 정의의 차이, 중복 등에서 생긴다. 아니면 없는 값을 부르려고 할 때(배열[0]이 없는데, [0]을 부를때, 생긴다.

9. 리턴값 문제

/Users/hyunchulKIM/20110429_onecode/./Ana_20110501_onecode.C: In function ‘bool passCut(double, double, int)’:
/Users/hyunchulKIM/20110429_onecode/./Ana_20110501_onecode.C:896: warning: control reaches end of non-void function
/Users/hyunchulKIM/20110429_onecode/./Ana_20110501_onecode.C: In function ‘int Ana_20110501_onecode(int, char*)’:
/Users/hyunchulKIM/20110429_onecode/./Ana_20110501_onecode.C:813: warning: control reaches end of non-void function

-> 리턴값을 주면 없어진다.

10. 배열 선언시 주의할 점

배열 선언 주의 선언을 [x][y]라고 하면, 0~x-1, 0~y-1까지 생긴다. 따라서, [i][0]을 불러오게 만들려면 선언은 [max(i)+1][1]로 해야 한다. 안 그러면, [i][0]을 선언하게 되면, 행이 i개이고, 열이0개인 배열이 되므로, 배열의 의미가 없어진다. 그러면 마지막에 저장된 값만 남게 된다.

-- HyunChulKim - 03 May 2011

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2011-05-03 - HyunChulKim
 
KOREA-CMS
This site is powered by the TWiki collaboration platform Powered by Perl This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding KoreaCmsWiki? Send feedback