]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDClusterFinder.cxx
Removed CDB in /home/basanta/ALISOFT/AliRoot
[u/mrichter/AliRoot.git] / PMD / AliPMDClusterFinder.cxx
index cfea1a907546153e410fd9be3b61a89129f8bf83..cc5ed7d57ecae870a62481ec99510dd69701ea0c 100644 (file)
@@ -260,6 +260,110 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt)
 }
 // ------------------------------------------------------------------------- //
 
+void AliPMDClusterFinder::Digits2RecPoints(TTree *digitsTree,
+                                          TTree *clustersTree)
+{
+  // Converts digits to recpoints after running clustering
+  // algorithm on CPV plane and PREshower plane
+  //
+
+  Int_t    det = 0,smn = 0;
+  Int_t    xpos,ypos;
+  Float_t  adc;
+  Int_t    ismn;
+  Int_t    idet;
+  Float_t  clusdata[6];
+
+  TObjArray *pmdcont = new TObjArray();
+  AliPMDClustering *pmdclust = new AliPMDClusteringV1();
+
+  pmdclust->SetEdepCut(fEcut);
+
+  AliPMDdigit  *pmddigit;
+  TBranch *branch = digitsTree->GetBranch("PMDDigit");
+  branch->SetAddress(&fDigits);
+
+  ResetRecpoint();
+
+  Int_t bufsize = 16000;
+  TBranch * branch1 = clustersTree->Branch("PMDRecpoint", &fRecpoints, bufsize); 
+  TBranch * branch2 = clustersTree->Branch("PMDRechit", &fRechits, bufsize); 
+
+  Int_t nmodules = (Int_t) digitsTree->GetEntries();
+
+  for (Int_t imodule = 0; imodule < nmodules; imodule++)
+    {
+      ResetCellADC();
+      digitsTree->GetEntry(imodule); 
+      Int_t nentries = fDigits->GetLast();
+      for (Int_t ient = 0; ient < nentries+1; ient++)
+       {
+         pmddigit = (AliPMDdigit*)fDigits->UncheckedAt(ient);
+         
+         det    = pmddigit->GetDetector();
+         smn    = pmddigit->GetSMNumber();
+         xpos   = pmddigit->GetRow();
+         ypos   = pmddigit->GetColumn();
+         adc    = pmddigit->GetADC();
+         
+         // CALIBRATION
+         Float_t gain = fCalibData->GetGainFact(det,smn,xpos,ypos);
+         // printf("adc = %d gain = %f\n",adc,gain);
+         
+         adc = adc*gain;
+
+         //Int_t trno   = pmddigit->GetTrackNumber();
+         fCellADC[xpos][ypos] = (Double_t) adc;
+       }
+
+      idet = det;
+      ismn = smn;
+      pmdclust->DoClust(idet,ismn,fCellADC,pmdcont);
+      
+      Int_t nentries1 = pmdcont->GetEntries();
+
+      AliDebug(1,Form("Total number of clusters/module = %d",nentries1));
+
+      for (Int_t ient1 = 0; ient1 < nentries1; ient1++)
+       {
+         AliPMDcluster *pmdcl = (AliPMDcluster*)pmdcont->UncheckedAt(ient1);
+         idet        = pmdcl->GetDetector();
+         ismn        = pmdcl->GetSMN();
+         clusdata[0] = pmdcl->GetClusX();
+         clusdata[1] = pmdcl->GetClusY();
+         clusdata[2] = pmdcl->GetClusADC();
+         clusdata[3] = pmdcl->GetClusCells();
+         clusdata[4] = pmdcl->GetClusSigmaX();
+         clusdata[5] = pmdcl->GetClusSigmaY();
+
+         AddRecPoint(idet,ismn,clusdata);
+
+         Int_t ncell = (Int_t) clusdata[3];
+         for(Int_t ihit = 0; ihit < ncell; ihit++)
+           {
+             Int_t celldataX = pmdcl->GetClusCellX(ihit);
+             Int_t celldataY = pmdcl->GetClusCellY(ihit);
+             AddRecHit(celldataX, celldataY);
+           }
+         branch2->Fill();
+         ResetRechit();
+       }
+      pmdcont->Clear();
+      
+      branch1->Fill();
+      ResetRecpoint();
+
+    } // modules
+
+  ResetCellADC();
+
+  //   delete the pointers
+  delete pmdclust;
+  delete pmdcont;
+    
+}
+// ------------------------------------------------------------------------- //
+
 void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
                                           TTree *clustersTree)
 {
@@ -291,7 +395,7 @@ void AliPMDClusterFinder::Digits2RecPoints(AliRawReader *rawReader,
   Int_t idet = 0;
   Int_t iSMN = 0;
 
-  
+
   for (Int_t indexDDL = 0; indexDDL < kDDL; indexDDL++)
     {
       if (indexDDL < 4)
@@ -571,8 +675,7 @@ void AliPMDClusterFinder::Digits2RecPoints(Int_t ievt, AliRawReader *rawReader)
 
          Float_t sig1 = (Float_t) sig;
          // CALIBRATION
-         //Float_t gain = fCalibData->GetGainFact(det,smn,row,col);
-         Float_t gain = 1.0;
+         Float_t gain = fCalibData->GetGainFact(det,smn,row,col);
 
          //printf("sig = %d gain = %f\n",sig,gain);
          sig = (Int_t) (sig1*gain);
@@ -814,23 +917,12 @@ AliPMDCalibData* AliPMDClusterFinder::GetCalibData() const
   // Added by ZA
   AliCDBEntry  *entry = AliCDBManager::Instance()->Get("PMD/Calib/Data");
   
-  if(!entry){
-    AliWarning("Calibration object retrieval failed! Dummy calibration will be used.");
-    
-    // this just remembers the actual default storage. No problem if it is null.
-    AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
-    AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
-    
-    entry = AliCDBManager::Instance()->Get("PMD/Calib/Data");
-    
-    // now reset the original default storage to AliCDBManager...
-    AliCDBManager::Instance()->SetDefaultStorage(origStorage);  
-  }
+  if(!entry)  AliFatal("Calibration object retrieval failed! ");
   
   AliPMDCalibData *calibdata=0;
   if (entry) calibdata = (AliPMDCalibData*) entry->GetObject();
   
-  if (!calibdata)  AliError("No calibration data from calibration database !");
+  if (!calibdata)  AliFatal("No calibration data from calibration database !");
   
   return calibdata;
 }