Hi Philippe,
Sorry to keep pestering, but it’s still not working for me yet.
[quote=“pcanal”][quote]the second option looks very hard for me to do (I’m trying to do this from within ATLAS’s Athena framework).[/quote]I have to believe that the Athena framework has a mean for you to generate the dictionary for your own classes!
[/quote]
Sure, but I don’t know how I’d get this to work within ROOT. Or at least, I do have an idea, but I’ve been struggling with this for about a week now and I need to get something working ASAP. I play some more later on, when I have a bit more time.
I’ve tried this, but when I get:
root [3] tv__tree->Scan("GlobalPhi:StationName");
***********************************************
* Row * Instance * GlobalPhi * StationNa *
***********************************************
* 0 * 0 * * <¹
* 1 * 0 * -0.371850 * <¹
* 1 * 1 * -0.368061 * <¹
* 1 * 2 * -0.364273 * <¹
* 1 * 3 * -0.360485 * <¹
* 1 * 4 * -0.356698 * <¹
* 1 * 5 * -0.352913 * <¹
i.e. the station name is corrupt (but everything else looks okay).
I’m completely baffled! I’m sure I’m doing something very stupid but I really can’t work out what.
Just in case haven’t provided enough information, here is the complete struct I fill:
struct PRDNTupleData {
TTree* tree;
int numPRDs;
int detectorType[MUONRECSTATISTICS_MAKEPRDNTUPLES_MAXPRDS];
int prdId[MUONRECSTATISTICS_MAKEPRDNTUPLES_MAXPRDS];
float prdLocX[MUONRECSTATISTICS_MAKEPRDNTUPLES_MAXPRDS];
float prdLocY[MUONRECSTATISTICS_MAKEPRDNTUPLES_MAXPRDS];
int prdPdgId[MUONRECSTATISTICS_MAKEPRDNTUPLES_MAXPRDS];
float prdGlobPhi[MUONRECSTATISTICS_MAKEPRDNTUPLES_MAXPRDS];
float prdGlobR[MUONRECSTATISTICS_MAKEPRDNTUPLES_MAXPRDS];
float prdGlobZ[MUONRECSTATISTICS_MAKEPRDNTUPLES_MAXPRDS];
int isPhi[MUONRECSTATISTICS_MAKEPRDNTUPLES_MAXPRDS];
char* stationNames[MUONRECSTATISTICS_MAKEPRDNTUPLES_MAXPRDS*10];
/**constructor*/
PRDNTupleData(TString name, TString title) :
numPRDs(0),
tree(new TTree(name,title))
{
tree->Branch("NumPRDs", &numPRDs, "numPRDs/I");
tree->Branch("DetectorType", &detectorType,"detectorType[numPRDs]/I");
tree->Branch("PrdIdentifier", &prdId, "prdIdentifier[numPRDs]/I");
tree->Branch("LocalX", &prdLocX, "localX[numPRDs]/F");
tree->Branch("LocalY", &prdLocY, "localY[numPRDs]/F");
tree->Branch("TruthPdgId", &prdPdgId, "truthPdgId[numPRDs]/I");
tree->Branch("GlobalPhi", &prdGlobPhi, "globalPhi[numPRDs]/F");
tree->Branch("GlobalR", &prdGlobR, "globalR[numPRDs]/F");
tree->Branch("GlobalZ", &prdGlobZ, "globalZ[numPRDs]/F");
tree->Branch("PhiMeasurement",&isPhi, "phiMeasurement[numPRDs]/I");
tree->Branch("StationName", &stationNames,"stationName[numPRDs]/C");
}
};
… and here is where I fill the char*
int index = m_prdData[type]->numPRDs;
TString stationName(m_idHelper->stationNameString(stationNameIndex));
m_prdData[type]->stationNames[index]=stationName.Data();
If you’re really curious/keen to help , the complete code is here:
atlas-sw.cern.ch/cgi-bin/viewcvs … cvs-markup
Cheers,
Ed