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