+
+//_____________________________________________________________________________
+void AliReconstruction::FillRawDataErrorLog(Int_t iEvent, AliESDEvent* esd)
+{
+ // The method reads the raw-data error log
+ // accumulated within the rawReader.
+ // It extracts the raw-data errors related to
+ // the current event and stores them into
+ // a TClonesArray inside the esd object.
+
+ if (!fRawReader) return;
+
+ for(Int_t i = 0; i < fRawReader->GetNumberOfErrorLogs(); i++) {
+
+ AliRawDataErrorLog *log = fRawReader->GetErrorLog(i);
+ if (!log) continue;
+ if (iEvent != log->GetEventNumber()) continue;
+
+ esd->AddRawDataErrorLog(log);
+ }
+
+}
+
+TNamed* AliReconstruction::CopyFileToTNamed(TString fPath,TString fName){
+ // Dump a file content into a char in TNamed
+ ifstream in;
+ in.open(fPath.Data(),ios::in | ios::binary|ios::ate);
+ Int_t kBytes = (Int_t)in.tellg();
+ printf("Size: %d \n",kBytes);
+ TNamed *fn = 0;
+ if(in.good()){
+ char* memblock = new char [kBytes];
+ in.seekg (0, ios::beg);
+ in.read (memblock, kBytes);
+ in.close();
+ TString fData(memblock,kBytes);
+ fn = new TNamed(fName,fData);
+ printf("fData Size: %d \n",fData.Sizeof());
+ printf("fName Size: %d \n",fName.Sizeof());
+ printf("fn Size: %d \n",fn->Sizeof());
+ delete[] memblock;
+ }
+ else{
+ AliInfo(Form("Could not Open %s\n",fPath.Data()));
+ }
+
+ return fn;
+}
+
+void AliReconstruction::TNamedToFile(TTree* fTree, TString fName){
+ // This is not really needed in AliReconstruction at the moment
+ // but can serve as a template
+
+ TList *fList = fTree->GetUserInfo();
+ TNamed *fn = (TNamed*)fList->FindObject(fName.Data());
+ printf("fn Size: %d \n",fn->Sizeof());
+
+ TString fTmp(fn->GetName()); // to be 100% sure in principle fName also works
+ const char* cdata = fn->GetTitle();
+ printf("fTmp Size %d\n",fTmp.Sizeof());
+
+ int size = fn->Sizeof()-fTmp.Sizeof()-sizeof(UChar_t)-sizeof(Int_t); // see dfinition of TString::SizeOf()...
+ printf("calculated size %d\n",size);
+ ofstream out(fName.Data(),ios::out | ios::binary);
+ out.write(cdata,size);
+ out.close();
+
+}
+
+
+
+//_____________________________________________________________________________
+//AliQADataMaker * AliReconstruction::GetQADataMaker(Int_t iDet)
+//{
+// get the quality assurance data maker object and the loader for a detector
+//
+// if (fQADataMaker[iDet])
+// return fQADataMaker[iDet];
+//
+// // load the QA data maker object
+// TPluginManager* pluginManager = gROOT->GetPluginManager();
+// TString detName = fgkDetectorName[iDet];
+// TString qadmName = "Ali" + detName + "QADataMaker";
+// if (gAlice && !gAlice->GetDetector(detName) && (detName != "HLT"))
+// return NULL;
+//
+// AliQADataMaker * qadm = NULL;
+// // first check if a plugin is defined for the quality assurance data maker
+// TPluginHandler* pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName);
+// // if not, add a plugin for it
+// if (!pluginHandler) {
+// AliDebug(1, Form("defining plugin for %s", qadmName.Data()));
+// TString libs = gSystem->GetLibraries();
+// if (libs.Contains("lib" + detName + "base.so") ||
+// (gSystem->Load("lib" + detName + "base.so") >= 0)) {
+// pluginManager->AddHandler("AliQADataMaker", detName,
+// qadmName, detName + "qadm", qadmName + "()");
+// } else {
+// pluginManager->AddHandler("AliQADataMaker", detName,
+// qadmName, detName, qadmName + "()");
+// }
+// pluginHandler = pluginManager->FindHandler("AliQADataMaker", detName);
+// }
+// if (pluginHandler && (pluginHandler->LoadPlugin() == 0)) {
+// qadm = (AliQADataMaker *) pluginHandler->ExecPlugin(0);
+// }
+// if (qadm) {
+// AliInfo(Form("Initializing quality assurance data maker for %s", fgkDetectorName[iDet]));
+// qadm->Init(AliQA::kRECPOINTS, AliCDBManager::Instance()->GetRun(), GetQACycles(fgkDetectorName[iDet]));
+// qadm->StartOfCycle(AliQA::kRECPOINTS);
+// qadm->Init(AliQA::kESDS, AliCDBManager::Instance()->GetRun());
+// qadm->StartOfCycle(AliQA::kESDS, "same") ;
+// fQADataMaker[iDet] = qadm;
+// }
+//
+// return qadm;
+//}
+//
+//_____________________________________________________________________________
+//Bool_t AliReconstruction::RunQA(const char* detectors, AliESDEvent *& esd)
+//{
+// // run the Quality Assurance data producer
+//
+// AliCodeTimerAuto("")
+// TString detStr = detectors;
+// for (Int_t iDet = 0; iDet < fgkNDetectors; iDet++) {
+// if (!IsSelected(fgkDetectorName[iDet], detStr))
+// continue;
+// AliQADataMaker * qadm = GetQADataMaker(iDet);
+// if (!qadm)
+// continue;
+// AliCodeTimerStart(Form("running quality assurance data maker for %s", fgkDetectorName[iDet]));
+// AliInfo(Form("running quality assurance data maker for %s", fgkDetectorName[iDet]));
+//
+// qadm->Exec(AliQA::kESDS, esd) ;
+// qadm->Increment() ;
+//
+// AliCodeTimerStop(Form("running quality assurance data maker for %s", fgkDetectorName[iDet]));
+// }
+// if ((detStr.CompareTo("ALL") != 0) && !detStr.IsNull()) {
+// AliError(Form("the following detectors were not found: %s",
+// detStr.Data()));
+// if (fStopOnError)
+// return kFALSE;
+// }
+//
+// return kTRUE;
+//
+//}
+//
+
+//_____________________________________________________________________________
+void AliReconstruction::CheckQA()
+{
+// check the QA of SIM for this run and remove the detectors
+// with status Fatal
+
+ TString newDetList ;
+ for (Int_t iDet = 0; iDet < AliQA::kNDET; iDet++) {
+ TString detName(AliQA::GetDetName(iDet)) ;
+ if ( fRunLocalReconstruction.Contains(AliQA::GetDetName(iDet)) ||
+ fRunLocalReconstruction.Contains("ALL") ) {
+ AliQA * qa = AliQA::Instance(AliQA::DETECTORINDEX(iDet)) ;
+ if ( qa->IsSet(AliQA::DETECTORINDEX(iDet), AliQA::kSIM, AliQA::kFATAL)) {
+ AliInfo(Form("QA status for %s in Hits and/or SDIGITS and/or Digits was Fatal; No reconstruction performed", detName.Data())) ;
+ } else if ( qa->IsSet(AliQA::DETECTORINDEX(iDet), AliQA::kSIM, AliQA::kERROR)) {
+ AliError(Form("QA status for %s in Hits and/or SDIGITS and/or Digits was ERROR", detName.Data())) ;
+ newDetList += detName ;
+ newDetList += " " ;
+ } else if ( qa->IsSet(AliQA::DETECTORINDEX(iDet), AliQA::kSIM, AliQA::kWARNING) ) {
+ AliWarning(Form("QA status for %s in Hits and/or SDIGITS and/or Digits was WARNING", detName.Data())) ;
+ newDetList += detName ;
+ newDetList += " " ;
+ } else if ( qa->IsSet(AliQA::DETECTORINDEX(iDet), AliQA::kSIM, AliQA::kINFO) ) {
+ AliInfo(Form("QA status for %s in Hits and/or SDIGITS and/or Digits was INFO", detName.Data())) ;
+ newDetList += detName ;
+ newDetList += " " ;
+ } else {
+ newDetList += detName ;
+ newDetList += " " ;
+ }
+ }
+ }
+ fRunLocalReconstruction = newDetList ;
+}
+
+//_____________________________________________________________________________
+Int_t AliReconstruction::GetDetIndex(const char* detector)
+{
+ // return the detector index corresponding to detector
+ Int_t index = -1 ;
+ for (index = 0; index < fgkNDetectors ; index++) {
+ if ( strcmp(detector, fgkDetectorName[index]) == 0 )
+ break ;
+ }
+ return index ;
+}