+void SendToAmoreDB(TObject *calipad, unsigned long32 runNb)
+{
+ //cheet a little -- temporary solution (hopefully)
+ //
+ //currently amoreDA uses the environment variable AMORE_DA_NAME to create the mysql
+ //table in which the calib objects are stored. This table is dropped each time AmoreDA
+ //is initialised. This of course makes a problem if we would like to store different
+ //calibration entries in the AMORE DB. Therefore in each DA which writes to the AMORE DB
+ //the AMORE_DA_NAME env variable is overwritten.
+
+
+ //
+ // The reference data are stored in:
+ // PadStatus1 for sm-00-01-02
+ // PadStatus2 for sm-03-04-05
+ // PadStatus3 for sm-06-07-08
+ // PadStatus4 for sm-09-10-11
+ // PadStatus5 for sm-12-13-14
+ // PadStatus6 for sm-15-16-17
+ // PadStatus0 if nothing found..means problems
+ //
+
+ ///////////////////
+ // Find wich LDC
+ ///////////////////
+ Int_t ldcnumber = -1;
+ Int_t sm = -1;
+ for (Int_t idet=0; idet<540; idet++) {
+ AliTRDCalROC *rocMean = ((AliTRDCalibPadStatus *) calipad)->GetCalRocMean(idet, kFALSE);
+ if ( rocMean ) {
+ sm = AliTRDgeometry::GetSector(idet);
+ if((sm==0) || (sm==1) || (sm==2)) ldcnumber = 1;
+ if((sm==3) || (sm==4) || (sm==5)) ldcnumber = 2;
+ if((sm==6) || (sm==7) || (sm==8)) ldcnumber = 3;
+ if((sm==9) || (sm==10) || (sm==11)) ldcnumber = 4;
+ if((sm==12) || (sm==13) || (sm==14)) ldcnumber = 5;
+ if((sm==15) || (sm==16) || (sm==17)) ldcnumber = 6;
+ }
+ }
+ const char *amoreDANameorig=gSystem->Getenv("AMORE_DA_NAME");
+
+ gSystem->Setenv("AMORE_DA_NAME",Form("TRD-dataQA-%02d-%s",ldcnumber,FILE_ID));
+
+ /////////////////////
+ // Send the stuff
+ ////////////////////
+ if (ldcnumber>-1){
+ TDatime time;
+ TObjString info(Form("Run: %u; Date: %s",runNb,time.AsSQLString()));
+
+ amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
+ Int_t statusDA=0;
+ statusDA+=amoreDA.Send("Pedestals",calipad);
+ statusDA+=amoreDA.Send("Info",&info);
+ if ( statusDA )
+ printf("Warning: Failed to write one of the calib objects to the AMORE database\n");
+ } else {
+ printf("Warning: No data found!\n");
+ }
+
+ // reset env var
+ if (amoreDANameorig) gSystem->Setenv("AMORE_DA_NAME",amoreDANameorig);
+
+}
+
+
+