]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - VZERO/AliVZEROPreprocessor.cxx
pointer to AliVZERODataDCS object deleted in destructor
[u/mrichter/AliRoot.git] / VZERO / AliVZEROPreprocessor.cxx
index cf67eb370c2cb2c9215da8596d004c75d2888d96..ab634ecec84e19bad86a4e920aff6c83329db6ac 100644 (file)
@@ -29,6 +29,8 @@ AliVZEROPreprocessor::AliVZEROPreprocessor(AliShuttleInterface* shuttle) :
 AliVZEROPreprocessor::~AliVZEROPreprocessor()
 {
   // destructor
+  
+   delete fData;
 }
 
 //______________________________________________________________________________________________
@@ -37,21 +39,20 @@ void AliVZEROPreprocessor::Initialize(Int_t run, UInt_t startTime,
 {
   // Creates AliZDCDataDCS object
 
-  AliPreprocessor::Initialize(run, startTime, endTime);
-
-       Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
+   AliPreprocessor::Initialize(run, startTime, endTime);
+  
+   Log(Form("\n\tRun %d \n\tStartTime %s \n\tEndTime %s", run,
                TTimeStamp(startTime).AsString(),
                TTimeStamp(endTime).AsString()));
 
-       fRun = run;
-        fStartTime = startTime;
-        fEndTime = endTime;
+   fRun       = run;
+   fStartTime = startTime;
+   fEndTime   = endTime;
 
-       fData = new AliVZERODataDCS(fRun, fStartTime, fEndTime);
+   fData      = new AliVZERODataDCS(fRun, fStartTime, fEndTime);
+   
 }
 
-
-
 //______________________________________________________________________________________________
 UInt_t AliVZEROPreprocessor::Process(TMap* dcsAliasMap)
 {
@@ -75,60 +76,46 @@ UInt_t AliVZEROPreprocessor::Process(TMap* dcsAliasMap)
        // The processing of the DCS input data is forwarded to AliVZERODataDCS
 
        fData->ProcessData(*dcsAliasMap);
-       //fData->Draw("");              // Draw the HV values as a function of time
-       //dcsAliasMap->Print("");       // Print out the HV values
+       //fData->Draw("");              // Draws the HV values as a function of time
+       //dcsAliasMap->Print("");       // Prints out the HV values
 
-       // Writing VZERO PMs HV values into calibration object
+       // Writes VZERO PMs HV values into VZERO calibration object
        calibData->SetMeanHV(fData->GetMeanHV());
        calibData->SetWidthHV(fData->GetWidthHV());
-  
-  
+    
    // *************** From DAQ ******************
-       TString SourcesId[3];
-       SourcesId[0] = "PEDESTALS";
-       SourcesId[1] = "GAINS";
-       SourcesId[2] = "SIGMAS";
-
-       for(int iSource=0;iSource<3;iSource++){
-               TList* sourceList = GetFileSources(kDAQ, SourcesId[iSource].Data());
-               if (!sourceList){
-                       AliError(Form("No sources found for id %s", SourcesId[iSource].Data()));                
-               return 1;   
-               }
-               AliInfo(Form("The following sources produced files with the id %s",SourcesId[iSource].Data()));
-               sourceList->Print();    
-
-               TIter iter(sourceList);
-               TObjString *source = 0;
+   
+       TString SourcesId = "CALIB";
+
+       TList* sourceList = GetFileSources(kDAQ, SourcesId.Data());
+       if (!sourceList)  {
+               Log(Form("No sources found for id %s", SourcesId.Data()));                      
+               return 1; }
+       Log(Form("The following sources produced files with the id %s",SourcesId.Data()));
+       sourceList->Print();    
+
+       TIter iter(sourceList);
+       TObjString *source = 0;
                
-               while((source=dynamic_cast<TObjString*> (iter.Next()))){
-                       fileName = GetFile(kDAQ, SourcesId[iSource].Data(), source->GetName());
-                       if (fileName.Length() > 0)
-                       AliInfo(Form("Got the file %s, now we can extract some values.", fileName.Data()));
-                       FILE *file;
-                       if((file = fopen(fileName.Data(),"r")) == NULL){
-               AliError(Form("Cannot open file %s",fileName.Data()));
-                       return 1;
-                       }
-                       Float_t Values[128];
-                       for(Int_t j=0; j<128; j++)fscanf(file,"%f",&Values[j]);
-                       fclose(file);
-               switch(iSource){
-                               case 0:
-                                       calibData->SetPedestal(Values);
-                                       break;
-                               case 1:
-                                       calibData->SetGain(Values);
-                                       break;
-                               case 2:
-                                       calibData->SetSigma(Values);
-                                       break;
-                               }
-               }
-               delete sourceList;
-
-       }
-      
+       while((source=dynamic_cast<TObjString*> (iter.Next()))){
+               fileName = GetFile(kDAQ, SourcesId.Data(), source->GetName());
+               if (fileName.Length() > 0)
+               Log(Form("Got the file %s, now we can extract some values.", fileName.Data()));
+               FILE *file;
+               if((file = fopen(fileName.Data(),"r")) == NULL){
+                                  Log(Form("Cannot open file %s",fileName.Data()));
+                                  return 1;}
+               Float_t Pedestals[128], Sigmas[128], Gains[128];
+               for(Int_t j=0; j<128; j++)fscanf(file,"%f %f %f ",
+                                         &Pedestals[j], &Sigmas[j], &Gains[j]);
+               fclose(file);
+               
+               calibData->SetPedestal(Pedestals);
+               calibData->SetSigma(Sigmas);                    
+               calibData->SetGain(Gains); }                            
+               
+       delete sourceList; 
+       delete source;      
   
   // Check that everything was properly transmitted
 
@@ -137,8 +124,8 @@ UInt_t AliVZEROPreprocessor::Process(TMap* dcsAliasMap)
 //   for(Int_t j=0; j<128; j++){printf("ADCSigma[%d] -> %f \n",j,calibData->GetSigma(j));}
 //   for(Int_t j=0; j<64; j++){printf("MeanHV[%d] -> %f \n",j,calibData->GetMeanHV(j));}
 //   for(Int_t j=0; j<64; j++){printf("WidthHV[%d] -> %f \n",j,calibData->GetWidthHV(j));}
-//   
-  // Now we  store the VZERO Calibration Object into CalibrationDB
+  
+  // Now we store the VZERO Calibration Object into CalibrationDB
   
   AliCDBMetaData metaData;
   metaData.SetBeamPeriod(0);