+ TTree *tree = new TTree("tree","");
+
+ // variables for filling the TTree
+ Int_t iSM = 0; // SuperModule index
+ Int_t iHW = 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;
+ // declare the branches
+ tree->Branch("iSM", &iSM, "iSM/I");
+ tree->Branch("iCol", &iCol, "iCol/I");
+ tree->Branch("iRow", &iRow, "iRow/I");
+ tree->Branch("iHW", &iHW, "iHW/I");
+ 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 = (AliEMCALSuperModuleCalibMapAPD *) fSuperModuleData[iSM];
+
+ for (Int_t j=0; j<nAPDPerSM; j++) {
+ iCol = j / AliEMCALGeoParams::fgkEMCALRows;
+ iRow = j % AliEMCALGeoParams::fgkEMCALRows;
+
+ AliEMCALCalibMapAPDVal * v = t->GetAPDVal(iCol, iRow);
+
+ if (swapSides) {
+ // C side, oriented differently than A side: swap is requested
+ iCol = AliEMCALGeoParams::fgkEMCALCols-1 - iCol;
+ iRow = AliEMCALGeoParams::fgkEMCALRows-1 - iRow;
+ }
+
+ iHW = v->GetHardWareId();
+ iAPDNum = v->GetAPDNum();
+ v30 = v->GetV30();
+ for (int k=0; k<3; k++) {
+ par[k] = v->GetPar(k);
+ parErr[k] = v->GetParErr(k);
+ }
+ iBreakDown = v->GetBreakDown();
+ darkCurrent = v->GetDarkCurrent();
+
+ tree->Fill();
+ }
+
+ } // i, SuperModule
+
+ tree->Write();
+ destFile.Close();
+
+ return;
+}
+
+//____________________________________________________________________________
+AliEMCALCalibMapAPD::~AliEMCALCalibMapAPD()
+{
+ fSuperModuleData.Delete();
+}
+
+//____________________________________________________________________________
+AliEMCALSuperModuleCalibMapAPD * AliEMCALCalibMapAPD::GetSuperModuleCalibMapAPDNum(Int_t supModIndex)const
+{ // getter via index