ClassImp(AliEMCALCalibMapAPD)
//____________________________________________________________________________
-AliEMCALCalibMapAPD::AliEMCALCalibMapAPD() :
- fNSuperModule(0),
- fSuperModuleData(0)
+AliEMCALCalibMapAPD::AliEMCALCalibMapAPD(const int nSM) :
+ fNSuperModule(nSM),
+ fSuperModuleData()
{
//Default constructor.
+ for (int i=0; i<fNSuperModule; i++) {
+ fSuperModuleData.Add(new AliEMCALSuperModuleCalibMapAPD(i));
+ }
+ fSuperModuleData.Compress(); // compress the TObjArray
+ fSuperModuleData.SetOwner(kTRUE);
}
//____________________________________________________________________________
}
fNSuperModule = nSM;
- if (fSuperModuleData) delete [] fSuperModuleData;
- fSuperModuleData = new AliEMCALSuperModuleCalibMapAPD[fNSuperModule];
Int_t iSM = 0; // SuperModule index
Int_t iCol = 0;
Int_t iRow = 0;
// list of values to be read
Int_t iHW = 0;
- Int_t APDNum = 0;
- Float_t V30 = 0;
- Float_t Par[3] = {0};
- Float_t ParErr[3] = {0};
- Int_t BreakDown = 0;
- Float_t DarkCurrent = 0;
+ Int_t iAPDNum = 0;
+ Float_t v30 = 0;
+ Float_t par[3] = {0};
+ Float_t parErr[3] = {0};
+ Int_t iBreakDown = 0;
+ Float_t darkCurrent = 0;
// end - all values
Int_t nAPDPerSM = AliEMCALGeoParams::fgkEMCALCols * AliEMCALGeoParams::fgkEMCALRows;
for (Int_t i = 0; i < fNSuperModule; i++) {
- AliEMCALSuperModuleCalibMapAPD &t = fSuperModuleData[i];
+ AliEMCALSuperModuleCalibMapAPD * t = (AliEMCALSuperModuleCalibMapAPD*) fSuperModuleData[i];
if (!inputFile) {
- printf("AliEMCALCalibMapAPD::ReadCalibMapAPDInfo - Error while reading input file; likely EOF..");
+ printf("AliEMCALCalibMapAPD::ReadCalibMapAPDInfo - Error while reading input file; likely EOF..\n");
return;
}
inputFile >> iSM;
- t.fSuperModuleNum = iSM;
+ t->SetSuperModuleNum(iSM);
for (Int_t j=0; j<nAPDPerSM; j++) {
inputFile >> iCol >> iRow >> iHW
- >> APDNum >> V30
- >> Par[0] >> Par[1] >> Par[2]
- >> ParErr[0] >> ParErr[1] >> ParErr[2]
- >> BreakDown >> DarkCurrent;
+ >> iAPDNum >> v30
+ >> par[0] >> par[1] >> par[2]
+ >> parErr[0] >> parErr[1] >> parErr[2]
+ >> iBreakDown >> darkCurrent;
+
+ // check that input values are not out bounds
+ if (iCol<0 || iCol>(AliEMCALGeoParams::fgkEMCALCols-1) ||
+ iRow<0 || iRow>(AliEMCALGeoParams::fgkEMCALRows-1) ) {
+ printf("AliEMCALCalibMapAPD::ReadCalibMapAPDInfo - Error while reading input file; j %d iCol %d iRow %d\n", j, iCol, iRow);
+ return;
+ }
// assume that this info is already swapped and done for this basis?
if (swapSides) {
iRow = AliEMCALGeoParams::fgkEMCALRows-1 - iRow;
}
- AliEMCALCalibMapAPDVal &v = t.fAPDVal[iCol][iRow];
-
- v.fHardWareId = iHW;
- v.fAPDNum = APDNum;
- v.fV30 = V30;
- v.fPar[0] = Par[0];
- v.fPar[1] = Par[1];
- v.fPar[2] = Par[2];
- v.fParErr[0] = ParErr[0];
- v.fParErr[1] = ParErr[1];
- v.fParErr[2] = ParErr[2];
- v.fBreakDown = BreakDown;
- v.fDarkCurrent = DarkCurrent;
+ AliEMCALCalibMapAPDVal * v = t->GetAPDVal(iCol, iRow);
+
+ v->SetHardWareId(iHW);
+ v->SetAPDNum(iAPDNum);
+ v->SetV30(v30);
+ v->SetPar(0, par[0]);
+ v->SetPar(1, par[1]);
+ v->SetPar(2, par[2]);
+ v->SetParErr(0, parErr[0]);
+ v->SetParErr(1, parErr[1]);
+ v->SetParErr(2, parErr[2]);
+ v->SetBreakDown(iBreakDown);
+ v->SetDarkCurrent(darkCurrent);
}
} // i, SuperModule
Int_t nAPDPerSM = AliEMCALGeoParams::fgkEMCALCols * AliEMCALGeoParams::fgkEMCALRows;
for (Int_t i = 0; i < fNSuperModule; i++) {
- AliEMCALSuperModuleCalibMapAPD &t = fSuperModuleData[i];
- outputFile << t.fSuperModuleNum << endl;
+ AliEMCALSuperModuleCalibMapAPD * t = (AliEMCALSuperModuleCalibMapAPD*) fSuperModuleData[i];
+ outputFile << t->GetSuperModuleNum() << endl;
for (Int_t j=0; j<nAPDPerSM; j++) {
iCol = j / AliEMCALGeoParams::fgkEMCALRows;
iRow = j % AliEMCALGeoParams::fgkEMCALRows;
- AliEMCALCalibMapAPDVal &v = t.fAPDVal[iCol][iRow];
+ AliEMCALCalibMapAPDVal * v = t->GetAPDVal(iCol, iRow);
if (swapSides) {
// C side, oriented differently than A side: swap is requested
iRow = AliEMCALGeoParams::fgkEMCALRows-1 - iRow;
}
- outputFile << iCol << " " << iRow << " " << v.fHardWareId
- << " " << v.fAPDNum << " " << v.fV30
- << " " << v.fPar[0] << " " << v.fPar[1] << " " << v.fPar[2]
- << " " << v.fParErr[0] << " " << v.fParErr[1] << " " << v.fParErr[2]
- << " " << v.fBreakDown << " " << v.fDarkCurrent << endl;
+ outputFile << iCol << " " << iRow << " " << v->GetHardWareId()
+ << " " << v->GetAPDNum() << " " << v->GetV30()
+ << " " << v->GetPar(0) << " " << v->GetPar(1) << " " << v->GetPar(2)
+ << " " << v->GetParErr(0) << " " << v->GetParErr(1) << " " << v->GetParErr(2)
+ << " " << v->GetBreakDown() << " " << v->GetDarkCurrent() << endl;
}
} // i, SuperModule
Int_t nAPDPerSM = AliEMCALGeoParams::fgkEMCALCols * AliEMCALGeoParams::fgkEMCALRows;
fNSuperModule = tree->GetEntries() / nAPDPerSM;
- if (fSuperModuleData) delete [] fSuperModuleData;
- fSuperModuleData = new AliEMCALSuperModuleCalibMapAPD[fNSuperModule];
-
Int_t iSM = 0; // SuperModule index
Int_t iCol = 0;
Int_t iRow = 0;
// list of values to be read
Int_t iHW = 0;
- Int_t APDNum = 0;
- Float_t V30 = 0;
- Float_t Par[3] = {0};
- Float_t ParErr[3] = {0};
- Int_t BreakDown = 0;
- Float_t DarkCurrent = 0;
+ Int_t iAPDNum = 0;
+ Float_t v30 = 0;
+ Float_t par[3] = {0};
+ Float_t parErr[3] = {0};
+ Int_t iBreakDown = 0;
+ Float_t darkCurrent = 0;
// end - all values
// declare the branches
tree->SetBranchAddress("iCol", &iCol);
tree->SetBranchAddress("iRow", &iRow);
tree->SetBranchAddress("iHW", &iHW);
- tree->SetBranchAddress("APDNum", &APDNum);
- tree->SetBranchAddress("V30", &V30);
- tree->SetBranchAddress("Par", Par);
- tree->SetBranchAddress("ParErr", ParErr);
- tree->SetBranchAddress("BreakDown", &BreakDown);
- tree->SetBranchAddress("DarkCurrent", &DarkCurrent);
+ tree->SetBranchAddress("APDNum", &iAPDNum);
+ tree->SetBranchAddress("V30", &v30);
+ tree->SetBranchAddress("Par", par);
+ tree->SetBranchAddress("ParErr", parErr);
+ tree->SetBranchAddress("BreakDown", &iBreakDown);
+ tree->SetBranchAddress("DarkCurrent", &darkCurrent);
for (int ient=0; ient<tree->GetEntries(); ient++) {
tree->GetEntry(ient);
// assume the index SuperModules come in order: i=iSM
- AliEMCALSuperModuleCalibMapAPD &t = fSuperModuleData[iSM];
- t.fSuperModuleNum = iSM;
+ AliEMCALSuperModuleCalibMapAPD * t = (AliEMCALSuperModuleCalibMapAPD*) fSuperModuleData[iSM];
+ t->SetSuperModuleNum(iSM);
// assume that this info is already swapped and done for this basis?
if (swapSides) {
iRow = AliEMCALGeoParams::fgkEMCALRows-1 - iRow;
}
- AliEMCALCalibMapAPDVal &v = t.fAPDVal[iCol][iRow];
-
- v.fHardWareId = iHW;
- v.fAPDNum = APDNum;
- v.fV30 = V30;
- v.fPar[0] = Par[0];
- v.fPar[1] = Par[1];
- v.fPar[2] = Par[2];
- v.fParErr[0] = ParErr[0];
- v.fParErr[1] = ParErr[1];
- v.fParErr[2] = ParErr[2];
- v.fBreakDown = BreakDown;
- v.fDarkCurrent = DarkCurrent;
-
+ AliEMCALCalibMapAPDVal * v = t->GetAPDVal(iCol, iRow);
+
+ v->SetHardWareId(iHW);
+ v->SetAPDNum(iAPDNum);
+ v->SetV30(v30);
+ v->SetPar(0, par[0]);
+ v->SetPar(1, par[1]);
+ v->SetPar(2, par[2]);
+ v->SetParErr(0, parErr[0]);
+ v->SetParErr(1, parErr[1]);
+ v->SetParErr(2, parErr[2]);
+ v->SetBreakDown(iBreakDown);
+ v->SetDarkCurrent(darkCurrent);
} //
return;
// variables for filling the TTree
Int_t iSM = 0; // SuperModule index
Int_t iHW = 0;
- Int_t APDNum = 0;
- Float_t V30 = 0;
- Float_t Par[3] = {0};
- Float_t ParErr[3] = {0};
- Int_t BreakDown = 0;
- Float_t DarkCurrent = 0;
+ Int_t iAPDNum = 0;
+ Float_t v30 = 0;
+ Float_t par[3] = {0};
+ Float_t parErr[3] = {0};
+ Int_t iBreakDown = 0;
+ Float_t darkCurrent = 0;
//
Int_t iCol = 0;
Int_t iRow = 0;
tree->Branch("iCol", &iCol, "iCol/I");
tree->Branch("iRow", &iRow, "iRow/I");
tree->Branch("iHW", &iHW, "iHW/I");
- tree->Branch("APDNum", &APDNum, "APDNum/I");
- tree->Branch("V30", &V30, "V30/F");
- tree->Branch("Par", &Par, "Par[3]/F");
- tree->Branch("ParErr", &ParErr, "ParErr[3]/F");
- tree->Branch("BreakDown", &BreakDown, "BreakDown/I");
- tree->Branch("DarkCurrent", &DarkCurrent, "DarkCurrent/F");
+ tree->Branch("APDNum", &iAPDNum, "APDNum/I");
+ tree->Branch("V30", &v30, "V30/F");
+ tree->Branch("Par", &par, "Par[3]/F");
+ tree->Branch("ParErr", &parErr, "ParErr[3]/F");
+ tree->Branch("BreakDown", &iBreakDown, "BreakDown/I");
+ tree->Branch("DarkCurrent", &darkCurrent, "DarkCurrent/F");
Int_t nAPDPerSM = AliEMCALGeoParams::fgkEMCALCols * AliEMCALGeoParams::fgkEMCALRows;
for (iSM = 0; iSM < fNSuperModule; iSM++) {
- AliEMCALSuperModuleCalibMapAPD &t = fSuperModuleData[iSM];
+ AliEMCALSuperModuleCalibMapAPD * t = (AliEMCALSuperModuleCalibMapAPD *) fSuperModuleData[iSM];
for (Int_t j=0; j<nAPDPerSM; j++) {
iCol = j / AliEMCALGeoParams::fgkEMCALRows;
iRow = j % AliEMCALGeoParams::fgkEMCALRows;
- AliEMCALCalibMapAPDVal &v = t.fAPDVal[iCol][iRow];
+ AliEMCALCalibMapAPDVal * v = t->GetAPDVal(iCol, iRow);
if (swapSides) {
// C side, oriented differently than A side: swap is requested
iRow = AliEMCALGeoParams::fgkEMCALRows-1 - iRow;
}
- iHW = v.fHardWareId;
- APDNum = v.fAPDNum;
- V30 = v.fV30;
+ iHW = v->GetHardWareId();
+ iAPDNum = v->GetAPDNum();
+ v30 = v->GetV30();
for (int k=0; k<3; k++) {
- Par[k] = v.fPar[k];
- ParErr[k] = v.fParErr[k];
+ par[k] = v->GetPar(k);
+ parErr[k] = v->GetParErr(k);
}
- BreakDown = v.fBreakDown;
- DarkCurrent = v.fDarkCurrent;
+ iBreakDown = v->GetBreakDown();
+ darkCurrent = v->GetDarkCurrent();
tree->Fill();
}
//____________________________________________________________________________
AliEMCALCalibMapAPD::~AliEMCALCalibMapAPD()
{
- delete [] fSuperModuleData;
+ fSuperModuleData.Delete();
}
//____________________________________________________________________________
-AliEMCALSuperModuleCalibMapAPD AliEMCALCalibMapAPD::GetSuperModuleCalibMapAPDId(Int_t supModIndex)const
-{
- AliEMCALSuperModuleCalibMapAPD t; // just to maybe prevent a crash, but we are returning something not-initialized so maybe not better really..
- if (!fSuperModuleData)
- return t;
-
- return fSuperModuleData[supModIndex];
-}
-
-//____________________________________________________________________________
-AliEMCALSuperModuleCalibMapAPD AliEMCALCalibMapAPD::GetSuperModuleCalibMapAPDNum(Int_t supModIndex)const
-{
- AliEMCALSuperModuleCalibMapAPD t; // just to maybe prevent a crash, but we are returning something not-initialized so maybe not better really..
- if (!fSuperModuleData)
- return t;
-
+AliEMCALSuperModuleCalibMapAPD * AliEMCALCalibMapAPD::GetSuperModuleCalibMapAPDNum(Int_t supModIndex)const
+{ // getter via index
for (int i=0; i<fNSuperModule; i++) {
- if (fSuperModuleData[i].fSuperModuleNum == supModIndex) {
- return fSuperModuleData[i];
+ AliEMCALSuperModuleCalibMapAPD * t = (AliEMCALSuperModuleCalibMapAPD*) fSuperModuleData[i];
+ if (t->GetSuperModuleNum() == supModIndex) {
+ return t;
}
}
- return t;
+ // if we arrived here, then nothing was found.. just return a NULL pointer
+ return NULL;
}