Alice MasterClass BuildRAAStudents

Hi everyone!

I’m currently working on the ALICE masterclass, trying to build the RAA and RCP code
using the base BuildRAAStudents.C file that’s in the Part2 of the masterclass. When
i try to run the code this warning and error appears to me:

Error in : Trying to dereference null pointer or trying to call routine taking non-null arguments.
Execution of your code was aborted.
/media/estudiantes/BULNES/Seminario/ALICE-DVD/Part2/BuildRAAStudents.C:146:4: warning: null passed to a callee that requires a non-null argument [-Wnonnull]
hTrackPtPbPb_0_5->Scale(1./nColl_0_5);

I’m currently using the last version of ROOT for Ubuntu20.04 ROOT v26/04.
If there someone who know about this problem or how it can be fixed?

It seems “hTrackPtPbPb_0_5” is uninitialized in your macro. You need to find out why.

Thank WIle_E_Coyote for the response.

I’m trying to figure it out why it’s uninitialized, but i don’t see in the macro why is happening:

//*********************************************************************************
// Start of main function 
// parameters: 
//  * filename         - name of the input-file
//*********************************************************************************
void BuildRAAStudents(TString filename = "RAABaseOutput.root"){

  //________Reset ROOT_______________________________________________________________
  gROOT->Reset();
	
  //________Set basic style setting__________________________________________________
  StyleSettings();				
  cout << "Analysing file " <<  filename.Data() << endl;
  
  //*********************************************************************************
  //Definition of number of Collisions in the different centrality classes
  //*********************************************************************************   
  Double_t nColl_0_5 =1686.87;	
  Double_t nColl_0_10 = 1502.7;
  Double_t nColl_5_10 = 1319.89;
  Double_t nColl_10_20 = 923.26;
  Double_t nColl_20_30 = 558.68;
  Double_t nColl_30_40 = 321.20;
  Double_t nColl_40_50 = 171.67;
  Double_t nColl_50_60 = 85.13;
  Double_t nColl_60_70 = 38.51;
  Double_t nColl_70_80 = 15.78;
  Double_t nColl_80_90 = 6.32;
	
  //*********************************************************************************
  //Attaching & reading the input-file
  //*********************************************************************************   
  TFile fileInput(filename.Data());  
  //____ reading the number of TPC tracks for pp events & 0-5% PbPb events___________
  TH1D *hNTracksTPCPbPb_0_5 =			(TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i",0,5));
  TH1D *hNTracksTPCPbPb_70_80 =		(TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i",70,80));
  /// To do: Do the same for the other centralities 
  //TH1D *hNTracksTPCPbPb_0_10 =               (TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i", 0,10)); 
  //TH1D *hNTracksTPCPbPb_5_10 =               (TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i", 5,10)); 
  //TH1D *hNTracksTPCPbPb_10_20 =               (TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i", 10,20)); 
  //TH1D *hNTracksTPCPbPb_20_30 =               (TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i", 20,30));
  //TH1D *hNTracksTPCPbPb_30_40 =               (TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i", 30,40));
  //TH1D *hNTracksTPCPbPb_40_50 =               (TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i", 40,50));
  //TH1D *hNTracksTPCPbPb_50_60 =               (TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i", 50,60));
  //TH1D *hNTracksTPCPbPb_60_70 =               (TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i", 60,70));
  //TH1D *hNTracksTPCPbPb_80_90 =               (TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i", 80,90));
  
  //_____reading the pt-spectrum for 0-5% & 70-80% PbPb events, scaling it___________
  //_____by corresponding number of Collisions (nColl)_______________________________
  TH1D *hTrackPtPbPb_0_5 =			(TH1D*)fileInput.Get(Form("trackPt_PbPb_%i-%i",0,5));
  hTrackPtPbPb_0_5-> Scale(1./nColl_0_5);
  
  TH1D *hTrackPtPbPb_70_80 =			(TH1D*)fileInput.Get(Form("trackPt_PbPb_%i-%i",70,80));
  hTrackPtPbPb_70_80-> Scale(1./nColl_70_80);

This is the code so far.

Looks like it cannot find the “trackPt_PbPb_0-5” histogram in your fileInput file (“RAABaseOutput.root”?).
Try: fileInput.ls();

With the fileInput.ls(); didn’t work, but changing the numbers %i in the (TH1D*)fileInput.Get(Form("nTracksTPC_PbPb_%i-%i",0,5)); with the number in the "RAABaseOutput.root" shows the Canvas and the first calculations. Thank you for your help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.