Re: [ROOTDOC] Some information(variables) in Hits.root can't be got,why?

From: Rene Brun <Rene.Brun_at_cern.ch>
Date: Mon, 17 Nov 2008 15:24:40 +0100


As clearly indicated by the error message, change   Hits->setBranchAddress("nCrystalCompton",&nCrystalCompton); to
  Hits->SetBranchAddress("nCrystalCompton",&nCrystalCompton);

Rene Brun

jinxia guo wrote:
> Dear users ,
>
> I am a gate user .I am using the MonteCarlo simulation software GATE
> to simulate PET system. I would get root data after
> simulation,so I have to analyze the root data by ROOT. Recently I
> encountered a problem when I analyzed the root data Hits.root.
> My program is as follows:
>
> {
> gROOT->Reset( );
>
> Char_t chRoot_File[100];
> TChain chain("Hits");
> sprintf(chRoot_File,"Hits.root",0);
>
> Int_t runID;
> Int_t eventID;
> Int_t rsectorID;
> Int_t moduleID;
> Int_t submoduleID;
> Int_t crystalID;
> Int_t layerID;
>
> Char_t processName[14];
> Float_t edep;
> Float_t posX;
> Float_t posY;
> Float_t posZ;
>
> Int_t parentID;
> Int_t photonID;
> Int_t primaryID;
> Double_t time;
>
> Float_t localPosX;
> Float_t localPosY;
> Float_t localPosZ;
>
> Int_t sourceID;
> Float_t sourcePosX;
> Float_t sourcePosY;
> Float_t sourcePosZ;
>
> Int_t nCrystalCompton;
> Int_t nCrystalRayleigh;
>
> Int_t volumeID[10];
> Char_t RayleighVolName[5];
> Char_t comptVolName[5];
> Int_t nPhantomCompton;
> Int_t nPhantomRayleigh;
>
> Int_t gantryID;
> Int_t trackID;
> Float_t stepLength;
> Float_t rotationAngle;
> Float_t axialPos;
>
> //######################################################################################
> //# Set branch addresses - Chain
> Hits #
> //######################################################################################
> Hits->SetBranchAddress("runID",&runID);
> Hits->SetBranchAddress("eventID",&eventID);
> Hits->SetBranchAddress("rsectorID",&rsectorID);
> Hits->SetBranchAddress("moduleID",&moduleID);
> Hits->SetBranchAddress("submoduleID",&submoduleID);
> Hits->SetBranchAddress("crystalID",&crystalID);
> Hits->SetBranchAddress("layerID",&layerID);
>
> Hits->SetBranchAddress("processName",processName);
> Hits->SetBranchAddress("edep",&edep);
> Hits->SetBranchAddress("posX",&posX);
> Hits->SetBranchAddress("posY",&posY);
> Hits->SetBranchAddress("posZ",&posZ);
>
> Hits->setBranchAddress("parentID",&parentID);
> Hits->setBranchAddress("photonID",&photonID);
> Hits->setBranchAddress("primaryID",&primaryID);
> Hits->SetBranchAddress("time",&time);
>
> Hits->SetBranchAddress("localPosX",&localPosX);
> Hits->SetBranchAddress("localPosY",&localPosY);
> Hits->SetBranchAddress("localPosZ",&localPosZ);
>
> Hits->SetBranchAddress("sourceID",&sourceID);
> Hits->SetBranchAddress("sourcePosX",&sourcePosX);
> Hits->SetBranchAddress("sourcePosY",&sourcePosY);
> Hits->SetBranchAddress("sourcePosZ",&sourcePosZ);
>
> Hits->setBranchAddress("nCrystalCompton",&nCrystalCompton);
> Hits->setBranchAddress("nCrystalRayleigh",&nCrystalRayleigh);
>
> Hits->setBranchAddress("volumeID",volumeID);
> Hits->setBranchAddress("RayleighVolName",RayleighVolName);
> Hits->setBranchAddress("comptVolName",comptVolName);
> Hits->setBranchAddress("nPhantomCompton",&nPhantomCompton);
> Hits->setBranchAddress("nPhantomRayleigh",&nPhantomRayleigh);
> Hits->setBranchAddress("axialPos",&axialPos);
>
> Hits->setBranchAddress("gantryID",&gantryID);
> Hits->setBranchAddress("trackID",&trackID);
> Hits->setBranchAddress("stepLength",&stepLength);
> Hits->setBranchAddress("rotationAngle",&rotationAngle);
>
> /////////////STAT////////
>
> gStyle -> SetStatW(0.28);
> gStyle -> SetStatH(0.3);
> gStyle -> SetStatColor(41);
> gStyle -> SetStatX(1);
> gStyle -> SetStatY(1);
> gStyle -> SetStatFont(42);
> gStyle->SetOptStat(0);
> gStyle->SetOptFit(0);
>
> /////////////////////////
>
> ...
> }
>
> Hits.root is Hits file. When I run this program, I would get the
> error information:
> Error: Can't call TChain::setBranchAddress("parentID",&parentID) in
> current scope Hits.c:130:
> Possible candidates are...
> *** Interpreter error recovered ***
>
> The same error information was given for variables:
> photonID,primaryID,nCrystalCompton,nCrystalRayleigh,
>
> volumeID,RayleighVolName,comptVolName,nPhantomCompton,nPhantomRayleigh,axialPos,gantryID,trackID,stepLength,
> rotationAngle.So I can't get these information,especially the primaryID.
>
> When I commented the variables as above,then the error information
> disappeared.And the other variables such
> as runID ,eventID,rsectorID,moduleID and so on can be used successfully.
>
> I don't know why this happened. Can anyone know the reason? Hope
> your help.Thanks very much.
>
> Best wishes,
>
> Jinxia Guo.
>
>
Received on Mon Nov 17 2008 - 15:20:25 CET

This archive was generated by hypermail 2.2.0 : Wed Nov 19 2008 - 17:50:02 CET