Hey,
I have a weird problem.
I write a custom class with dictionary generated into a TTree. This class also has vectors inside. When I try to read the data from the TTree I get:
ModData.h
[code]#ifndef MODDATA_H
#define MODDATA_H
#include “Rtypes.h”
#include “datastructure/ModPropVector2D.h”
#include “Constants.h”
class ModData
{
public:
std::vector pedestal;
std::vector cmnoise;
std::vector rawnoise; //noise without CMC
std::vector snoise; //noise after CMC
std::vector gnoise; //noise after CMC
std::vector noise; //noise after CMC
std::vector noisecal; //noise after CMC
std::vector clwid; //cluster width histograms
std::vector hits;
std::vector hitsperevent;
std::vector<std::vector > hitspersubevent;
std::vector stripok; //noisy strips are masked with 0, others 1
unsigned short number_strips;
unsigned short number_strips_zone; //number of strips in current zone
unsigned short number_stripsok;
double perc_stripsok;
double tm_noise; //Truncated Mean Noise
double gf_noise; //Gauss Fit Noise
double mpsignal;
double mpsignalcal;
double meansignal;
unsigned int hitentries; //all unsigned long changed to unsigned int by Erik 1611101616
double mpsnr;
double meanclwid;
ModData(int the_max_apv_per_mod,
int the_apv_channels,
int the_max_subevents,
int the_max_hits_per_event);
ModData(const hat::ModProp* readmodprop);
ModData(const ModData& other);
virtual ~ModData();
ClassDef(ModData,1)
};
#endif[/code]
ModData.cpp
[code]#include “ModData.h”
ClassImp(ModData)
using namespace std;
ModData::ModData(int the_max_apv_per_mod,
int the_apv_channels,
int the_max_subevents,
int the_max_hits_per_event) :
pedestal( vector(the_max_apv_per_modthe_apv_channels, 0) ),
cmnoise( vector(the_max_apv_per_modthe_apv_channels/32, 0) ),
rawnoise( vector(the_max_apv_per_modthe_apv_channels, 0) ),
snoise( vector(the_max_apv_per_modthe_apv_channels, 0) ),
gnoise( vector(the_max_apv_per_modthe_apv_channels, 0) ),
noise( vector(the_max_apv_per_modthe_apv_channels, 0) ),
noisecal( vector(the_max_apv_per_modthe_apv_channels, 0) ),
clwid( vector(the_max_apv_per_modthe_apv_channels, 0) ),
hits( vector(the_max_apv_per_modthe_apv_channels, 0) ),
hitsperevent( vector(the_max_apv_per_modthe_apv_channels, 0) ),
hitspersubevent( vector<vector >(the_max_subevents, vector(the_max_hits_per_event, 0) ) ),
stripok( vector(the_max_apv_per_mod*the_apv_channels, 0) ),
number_strips(0),
number_strips_zone(0), //number of strips in current zone
number_stripsok(0),
perc_stripsok(0),
tm_noise(0), //Truncated Mean Noise
gf_noise(0), //Gauss Fit Noise
mpsignal(0),
mpsignalcal(0),
meansignal(0),
hitentries(0),
mpsnr(0),
meanclwid(0)
{}
ModData::ModData(const hat::ModProp* readmodprop) :
pedestal( readmodprop->pedestal ),
cmnoise( readmodprop->cmnoise ),
rawnoise( readmodprop->rawnoise ),
snoise( readmodprop->snoise ),
gnoise( readmodprop->gnoise ),
noise( readmodprop->noise ),
noisecal( readmodprop->noisecal ),
clwid( readmodprop->clwid ),
hits( readmodprop->hits ),
hitsperevent( readmodprop->hitsperevent ),
hitspersubevent( readmodprop->hitspersubevent ),
stripok( readmodprop->stripok ),
number_strips( readmodprop->number_strips ),
number_strips_zone( readmodprop->number_strips_zone ), //number of strips in current zone
number_stripsok( readmodprop->number_stripsok ),
perc_stripsok( readmodprop->perc_stripsok ),
tm_noise( readmodprop->tm_noise ), //Truncated Mean Noise
gf_noise( readmodprop->gf_noise ), //Gauss Fit Noise
mpsignal( readmodprop->mpsignal ),
mpsignalcal( readmodprop->mpsignalcal ),
meansignal( readmodprop->meansignal ),
hitentries( readmodprop->hitentries ),
mpsnr( readmodprop->mpsnr ),
meanclwid( readmodprop->meanclwid )
{}
ModData::ModData(const ModData& other) :
pedestal( other.pedestal ),
cmnoise( other.cmnoise ),
rawnoise( other.rawnoise ),
snoise( other.snoise ),
gnoise( other.gnoise ),
noise( other.noise ),
noisecal( other.noisecal ),
clwid( other.clwid ),
hits( other.hits ),
hitsperevent( other.hitsperevent ),
hitspersubevent( other.hitspersubevent ),
stripok( other.stripok ),
number_strips( other.number_strips ),
number_strips_zone( other.number_strips_zone ), //number of strips in current zone
number_stripsok( other.number_stripsok ),
perc_stripsok( other.perc_stripsok ),
tm_noise( other.tm_noise ), //Truncated Mean Noise
gf_noise( other.gf_noise ), //Gauss Fit Noise
mpsignal( other.mpsignal ),
mpsignalcal( other.mpsignalcal ),
meansignal( other.meansignal ),
hitentries( other.hitentries ),
mpsnr( other.mpsnr ),
meanclwid( other.meanclwid )
{}
ModData::~ModData() {}[/code]
I am reading the data like:
TFile *f = new TFile;
TTree *tmodprop = new TTree;
int tmodpropentr;
ModData* mprop = 0;
f = new TFile(filename,"READ");
tmodprop = dynamic_cast<TTree*>(f->Get("TCluster2DCNM_Module_4_Zone_1_tmodprop"));
tmodpropentr = tmodprop->GetEntries();
tmodprop->SetBranchAddress("mprops",&mprop);
Any ideas?
BR Erik