memory leak is rectified
authorbasanta <basanta@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 11 Jun 2008 14:52:08 +0000 (14:52 +0000)
committerbasanta <basanta@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 11 Jun 2008 14:52:08 +0000 (14:52 +0000)
PMD/AliPMDCalibGain.cxx
PMD/AliPMDCalibGain.h
PMD/PMDGAINda.cxx

index 07d8bc0..02355e0 100644 (file)
@@ -113,11 +113,11 @@ AliPMDCalibGain::~AliPMDCalibGain()
 
 }
 // ------------------------------------------------------------------------ //
-Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader)
+Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader, TObjArray *pmdddlcont)
 {
   // Calculates the ADC of isolated cell
 
-  TObjArray pmdddlcont;
+  //TObjArray pmdddlcont;
 
   const Int_t kDDL           = AliDAQ::NumberOfDdls("PMD");
   const Int_t kCellNeighbour = 6;
@@ -150,13 +150,13 @@ Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader)
 
   Int_t numberofDDLs = 0;
 
-    while ((iddl = rawStream.DdlData(&pmdddlcont)) >=0) {
+    while ((iddl = rawStream.DdlData(pmdddlcont)) >=0) {
       numberofDDLs++;
 
-      Int_t ientries = pmdddlcont.GetEntries();
+      Int_t ientries = pmdddlcont->GetEntries();
       for (Int_t ient = 0; ient < ientries; ient++)
       {
-         AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont.UncheckedAt(ient);
+         AliPMDddldata *pmdddl = (AliPMDddldata*)pmdddlcont->UncheckedAt(ient);
          
          Int_t idet = pmdddl->GetDetector();
          Int_t ismn = pmdddl->GetSMN();
@@ -171,7 +171,7 @@ Bool_t AliPMDCalibGain::ProcessEvent(AliRawReader *rawReader)
              d1[idet][ismn][irow][icol] = (Float_t) isig;
          }
       }
-      pmdddlcont.Clear();
+      pmdddlcont->Delete();
   }
   
   for(Int_t idet=0; idet < kDet; idet++)
@@ -235,10 +235,8 @@ void AliPMDCalibGain::Analyse(TTree *gaintree)
     {
        for(Int_t ism = 0; ism < kMaxSMN; ism++)
        {
-
            if (fSMCount[idet][ism] > 0)
                modmean = fSMIso[idet][ism]/fSMCount[idet][ism];
-
            for(Int_t irow = 0; irow < kMaxRow; irow++)
            {
                for(Int_t icol = 0; icol < kMaxCol; icol++)
index a27c08c..db04abf 100644 (file)
@@ -17,7 +17,7 @@ class AliPMDCalibGain : public TObject
 
   virtual ~AliPMDCalibGain() ;     // dtor
 
-  Bool_t ProcessEvent(AliRawReader *rawReader);  //Looks for iso cells
+  Bool_t ProcessEvent(AliRawReader *rawReader, TObjArray *pmdddlcont);  //Looks for iso cells
 
   void Analyse(TTree *gaintree);
   
@@ -36,6 +36,6 @@ class AliPMDCalibGain : public TObject
   Float_t fCellIso[kDet][kMaxSMN][kMaxRow][kMaxCol]; // adc of iso cells
   Float_t fCellCount[kDet][kMaxSMN][kMaxRow][kMaxCol]; // counter
 
-ClassDef(AliPMDCalibGain,2)        // description 
+ClassDef(AliPMDCalibGain,3)        // description 
 };
 #endif // ALIPMDCALIBGAIN_H
index 96f6eff..51a260a 100644 (file)
@@ -2,11 +2,12 @@
 PMD DA for online calibration
 
 contact: basanta@phy.iitb.ac.in
-Link:/afs/cern.ch/user/b/bnandi/public/
+Link:http://www.veccal.ernet.in/~pmd/
+Reference run:
 Run Type: PHYSICS
 DA Type: MON
 Number of events needed: 1 million for PB+PB, 200 milion for p+p
-Input Files: data raw
+Input Files: 
 Output Files: pmd_calib.root, to be exported to the DAQ FXS
 Trigger types used: PHYSICS_EVENT
 
@@ -53,9 +54,9 @@ int main(int argc, char **argv) {
 
     AliPMDCalibGain calibgain;
 
-    TTree *gain = new TTree("gain","PMD Gain tree");
+    TTree *ic = NULL;
 
-    TH1F::AddDirectory(0);
+    //TH1F::AddDirectory(0);
   
     
     // decoding the events
@@ -101,7 +102,8 @@ int main(int argc, char **argv) {
     int nevents_total=0;
     
     struct eventHeaderStruct *event;
-    eventTypeType eventT;
+    eventTypeType eventT = 0;
+
     Int_t iev=0;
     
     /* main loop (infinite) */
@@ -145,9 +147,13 @@ int main(int argc, char **argv) {
                
            case PHYSICS_EVENT:
                nevents_physics++;
+               if(nevents_physics%100 == 0)printf("Physis Events = %d\n",nevents_physics);
                AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-               calibgain.ProcessEvent(rawReader);
+               TObjArray *pmdddlcont = new TObjArray();
+               calibgain.ProcessEvent(rawReader, pmdddlcont);
 
+               delete pmdddlcont;
+               pmdddlcont = 0x0;
                delete rawReader;
                rawReader = 0x0;
                
@@ -156,13 +162,15 @@ int main(int argc, char **argv) {
        /* free resources */
        free(event);
        
-       /* exit when last event received, no need to wait for TERM signal */
-       if (eventT==END_OF_RUN) {
-           printf("EOR event detected\n");
-           calibgain.Analyse(gain);
-           
-           break;
-       }
+    }
+
+    /* exit when last event received, no need to wait for TERM signal */
+    if (eventT==END_OF_RUN) {
+      printf("EOR event detected\n");
+
+      ic = new TTree("ic","PMD Gain tree");
+      calibgain.Analyse(ic);
+      //break;
     }
     
     //write the Run level file   
@@ -177,15 +185,16 @@ int main(int argc, char **argv) {
     fprintf(fp,"Run #%s, received %d physics events out of %d\n",getenv("DATE_RUN_NUMBER"),nevents_physics,nevents_total);
     
 
-    TFile * gainRun = new TFile ("pmd_calib.root","RECREATE"); 
-    gain->Write();
+    TFile * gainRun = new TFile ("PMDGAINS.root","RECREATE"); 
+    ic->Write();
     gainRun->Close();
     
     
-    
+    delete ic;
+    ic = 0;
+
     /* close result file */
     fclose(fp);
-    
-    
+
     return status;
 }