[Gate-users] Some information(variables) in Hits.root can't be got, why?

jinxia guo babygjx at gmail.com
Fri Nov 14 09:07:35 CET 2008


Dear users ,

I encountered a question when I dealt the  data of 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.



--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opengatecollaboration.org/mailman/private/gate-users/attachments/20081114/11c571fb/attachment.htm>


More information about the Gate-users mailing list