]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TPC/AliTPCcalibTracks.cxx
Fixing the problem that was causing the dip (savannah bug 48080):
[u/mrichter/AliRoot.git] / TPC / AliTPCcalibTracks.cxx
index 86755828a6d0042e3c3e216ffb97ad98d75e6604..ee6f472738fdf6fedb6780a1409328237fade97c 100644 (file)
@@ -350,22 +350,22 @@ AliTPCcalibTracks::AliTPCcalibTracks(const Text_t *name, const Text_t *title, Al
       
       // amplitude
       sprintf(chname,"Amp_Sector%d",i);
-      his1 = new TH1F(chname,chname,250,0,500);         // valgrind 
+      his1 = new TH1F(chname,chname,100,0,32);         // valgrind 
       his1->SetXTitle("Max Amplitude (ADC)");
       fArrayAmp->AddAt(his1,i);
       sprintf(chname,"Amp_Sector%d",i+36);
-      his1 = new TH1F(chname,chname,200,0,600);         // valgrind 3   13,408,208 bytes in 229 blocks are still reachable
+      his1 = new TH1F(chname,chname,100,0,32);         // valgrind 3   13,408,208 bytes in 229 blocks are still reachable
       his1->SetXTitle("Max Amplitude (ADC)");
       fArrayAmp->AddAt(his1,i+36);
       
       // driftlength
       sprintf(chname, "driftlengt vs. charge, ROC %i", i);
-      prof1 = new TProfile(chname, chname, 500, 0, 250);
+      prof1 = new TProfile(chname, chname, 25, 0, 250);
       prof1->SetYTitle("Charge");
       prof1->SetXTitle("Driftlength");
       fArrayChargeVsDriftlength->AddAt(prof1,i);
       sprintf(chname, "driftlengt vs. charge, ROC %i", i+36);
-      prof1 = new TProfile(chname, chname, 500, 0, 250);
+      prof1 = new TProfile(chname, chname, 25, 0, 250);
       prof1->SetYTitle("Charge");
       prof1->SetXTitle("Driftlength");
       fArrayChargeVsDriftlength->AddAt(prof1,i+36);
@@ -421,18 +421,18 @@ AliTPCcalibTracks::AliTPCcalibTracks(const Text_t *name, const Text_t *title, Al
       for (Int_t ipad = 0; ipad < 3; ipad++){
          Int_t   bin   = GetBin(iq, ipad);
          Float_t qmean = GetQ(bin);
-         char name[200];
-         sprintf(name,"ResolY Pad%d Qmiddle%f",ipad, qmean);
-         his3D = new TH3F(name, name, 20,10,250, 20, 0,1.5, 50, -1,1);
+         char hname[200];
+         sprintf(hname,"ResolY Pad%d Qmiddle%f",ipad, qmean);
+         his3D = new TH3F(hname, hname, 20,10,250, 20, 0,1.5, 100, -1,1);
          fArrayQDY->AddAt(his3D, bin);
-         sprintf(name,"ResolZ Pad%d Qmiddle%f",ipad, qmean);
-         his3D = new TH3F(name, name, 20,10,250, 20, 0,1.5, 50, -1,1);
+         sprintf(hname,"ResolZ Pad%d Qmiddle%f",ipad, qmean);
+         his3D = new TH3F(hname, hname, 20,10,250, 20, 0,1.5, 100, -1,1);
          fArrayQDZ->AddAt(his3D, bin);
-         sprintf(name,"RMSY Pad%d Qmiddle%f",ipad, qmean);
-         his3D = new TH3F(name, name, 20,10,250, 20, 0,1.5, 50, 0,1);
+         sprintf(hname,"RMSY Pad%d Qmiddle%f",ipad, qmean);
+         his3D = new TH3F(hname, hname, 20,10,250, 20, 0,1.5, 100, 0,0.6);
          fArrayQRMSY->AddAt(his3D, bin);
-         sprintf(name,"RMSZ Pad%d Qmiddle%f",ipad, qmean);
-         his3D = new TH3F(name, name, 20,10,250, 20, 0,1.5, 50, 0,1);
+         sprintf(hname,"RMSZ Pad%d Qmiddle%f",ipad, qmean);
+         his3D = new TH3F(hname, hname, 20,10,250, 20, 0,1.5, 100, 0,0.6);
          fArrayQRMSZ->AddAt(his3D, bin);
       }
    }
@@ -824,21 +824,21 @@ void  AliTPCcalibTracks::FillResolutionHistoLocal(AliTPCseed * track){
          paramZ0 -= paramZ1;
          matrixY0 += matrixY1;
          matrixZ0 += matrixZ1;
-         Double_t chi2 = 0;
+         Double_t cchi2 = 0;
          
          TMatrixD difY(2, 1, paramY0.GetMatrixArray());
          TMatrixD difYT(1, 2, paramY0.GetMatrixArray());
          matrixY0.Invert();
          TMatrixD mulY(matrixY0, TMatrixD::kMult, difY);
          TMatrixD chi2Y(difYT, TMatrixD::kMult, mulY);
-         chi2 += chi2Y(0, 0);
+         cchi2 += chi2Y(0, 0);
          
          TMatrixD difZ(2, 1, paramZ0.GetMatrixArray());
          TMatrixD difZT(1, 2, paramZ0.GetMatrixArray());
          matrixZ0.Invert();
          TMatrixD mulZ(matrixZ0, TMatrixD::kMult, difZ);
          TMatrixD chi2Z(difZT, TMatrixD::kMult, mulZ);
-         chi2 += chi2Z(0, 0);      
+         cchi2 += chi2Z(0, 0);      
          
          // REMOVE KINK - TO be fixed - proper chi2 calculation for curved track to be implemented
          //if (chi2 * 0.25 > kCutChi2) fRejectedTracksHisto->Fill(8);
@@ -850,10 +850,9 @@ void  AliTPCcalibTracks::FillResolutionHistoLocal(AliTPCseed * track){
          // if this chi2 is bigger than a given threshold, assume that the current cluster is
          // a kink an goto next padrow
 
-        TTreeSRedirector *cstream = GetDebugStreamer();
         if (cstream){
           (*cstream)<<"Cut8"<<
-            "chi2="<<chi2<<
+            "chi2="<<cchi2<<
             "\n";
         }       
       }
@@ -890,16 +889,17 @@ void  AliTPCcalibTracks::FillResolutionHistoLocal(AliTPCseed * track){
       
       TProfile *profAmpRow =  (TProfile*)fArrayAmpRow->At(sector);
       if ( irow >= kFirstLargePad) max /= kLargePadSize;
-      profAmpRow->Fill( (Double_t)cluster0->GetRow(), max );
+      Double_t smax = TMath::Sqrt(max);
+      profAmpRow->Fill( (Double_t)cluster0->GetRow(), smax );
       TH1F *hisAmp =  (TH1F*)fArrayAmp->At(sector);
-      hisAmp->Fill(max);
+      hisAmp->Fill(smax);
       
       // remove the following two lines one day:
       TProfile *profDriftLength = (TProfile*)fArrayChargeVsDriftlength->At(sector);
-      profDriftLength->Fill( 250.-(Double_t)TMath::Abs(cluster0->GetZ()), max );
+      profDriftLength->Fill( 250.-(Double_t)TMath::Abs(cluster0->GetZ()), smax );
       
       TProfile *profDriftLengthTmp = (TProfile*)(fcalPadRegionChargeVsDriftlength->GetObject(isegment, padSize));
-      profDriftLengthTmp->Fill( 250.-(Double_t)TMath::Abs(cluster0->GetZ()), max );
+      profDriftLengthTmp->Fill( 250.-(Double_t)TMath::Abs(cluster0->GetZ()), smax );
       
       fHclusterPerPadrow->Fill(irow);   // fill histogram showing clusters per padrow
       Int_t ipad = TMath::Nint(cluster0->GetPad());
@@ -1363,7 +1363,7 @@ void AliTPCcalibTracks::Draw(Option_t* opt){
 }
 
 
-void AliTPCcalibTracks::MakeReport(Int_t stat, char* pathName){ 
+void AliTPCcalibTracks::MakeReport(Int_t stat, const char* pathName){ 
    // 
    // all functions are called, that produce pictures
    // the histograms are written to the directory 'pathName'
@@ -1382,7 +1382,7 @@ void AliTPCcalibTracks::MakeReport(Int_t stat, char* pathName){
 }
    
 
-void AliTPCcalibTracks::MakeAmpPlots(Int_t stat, char* pathName){ 
+void AliTPCcalibTracks::MakeAmpPlots(Int_t stat, const char* pathName){ 
    // 
    // creates several plots:
    // fArrayAmp.ps, fArrayAmpRow.ps and DeltaYZ.ps
@@ -1452,7 +1452,7 @@ void AliTPCcalibTracks::MakeAmpPlots(Int_t stat, char* pathName){
 }
 
 
-void AliTPCcalibTracks::MakeDeltaPlots(char* pathName){
+void AliTPCcalibTracks::MakeDeltaPlots(const char* pathName){
    // 
    // creates several plots:
    // DeltaYZ.ps: DeltaY and DeltaZ histogram with gaus fit
@@ -1489,7 +1489,7 @@ void AliTPCcalibTracks::MakeDeltaPlots(char* pathName){
 }
 
 
-void AliTPCcalibTracks::MakeChargeVsDriftLengthPlotsOld(char* pathName){
+void AliTPCcalibTracks::MakeChargeVsDriftLengthPlotsOld(const char* pathName){
    // 
    // creates charge vs. driftlength plots, one TProfile for each ROC
    // is not correct like this, should be one TProfile for each sector and padsize
@@ -1531,7 +1531,7 @@ void AliTPCcalibTracks::MakeChargeVsDriftLengthPlotsOld(char* pathName){
 }   
 
 
-void AliTPCcalibTracks::MakeChargeVsDriftLengthPlots(char* pathName){
+void AliTPCcalibTracks::MakeChargeVsDriftLengthPlots(const char* pathName){
    // 
    // creates charge vs. driftlength plots, one TProfile for each ROC
    // under development....
@@ -1593,7 +1593,7 @@ void AliTPCcalibTracks::MakeChargeVsDriftLengthPlots(char* pathName){
 
 
 
-void AliTPCcalibTracks::FitResolutionNew(char* pathName){
+void AliTPCcalibTracks::FitResolutionNew(const char* pathName){
    // 
    // calculates different resulution fits in Y and Z direction
    // the histograms are written to 'ResolutionYZ.ps'
@@ -1716,7 +1716,7 @@ void AliTPCcalibTracks::FitResolutionNew(char* pathName){
 }
 
 
-void AliTPCcalibTracks::FitRMSNew(char* pathName){
+void AliTPCcalibTracks::FitRMSNew(const char* pathName){
    // 
    // calculates different resulution-rms fits in Y and Z direction
    // the histograms are written to 'RMS_YZ.ps'
@@ -1839,7 +1839,7 @@ void AliTPCcalibTracks::FitRMSNew(char* pathName){
 }
 
 
-void AliTPCcalibTracks::MakeResPlotsQTree(Int_t minEntries, char* pathName){
+void AliTPCcalibTracks::MakeResPlotsQTree(Int_t minEntries, const char* pathName){
    //
    // Make tree with resolution parameters
    // the result is written to 'resol.root' in directory 'pathname'
@@ -2192,7 +2192,7 @@ Long64_t AliTPCcalibTracks::Merge(TCollection *collectionList) {
    AliTPCcalibTracks *calibTracks = 0;
    if (GetDebugLevel() > 1) cout << "start to iterate, filling lists" << endl;    
    Int_t counter = 0;
-   while ( (calibTracks = (AliTPCcalibTracks*)listIterator->Next()) ){
+   while ( (calibTracks = dynamic_cast<AliTPCcalibTracks*> (listIterator->Next())) ){
       // loop over all entries in the collectionList and get dataMembers into lists
       if (!calibTracks) continue;
       
@@ -2215,8 +2215,10 @@ Long64_t AliTPCcalibTracks::Merge(TCollection *collectionList) {
       clusterCutHistoList->Add(calibTracks->GetfClusterCutHisto());
       hclusterPerPadrowList->Add(calibTracks->GetfHclusterPerPadrow());
       hclusterPerPadrowRawList->Add(calibTracks->GetfHclusterPerPadrowRaw());
-      fCalPadClusterPerPad->Add(calibTracks->GetfCalPadClusterPerPad());
-      fCalPadClusterPerPadRaw->Add(calibTracks->GetfCalPadClusterPerPadRaw());
+      //
+      if (fCalPadClusterPerPad && calibTracks->GetfCalPadClusterPerPad())
+       fCalPadClusterPerPad->Add(calibTracks->GetfCalPadClusterPerPad());      
+      //      fCalPadClusterPerPadRaw->Add(calibTracks->GetfCalPadClusterPerPadRaw());
       counter++;
       if (GetDebugLevel() > 5) cout << "filling lists, object " << counter << " added." << endl;
    }
@@ -2256,9 +2258,9 @@ Long64_t AliTPCcalibTracks::Merge(TCollection *collectionList) {
    if (GetDebugLevel() > 0) cout << "merging fArrayAmps..." << endl;
    // merge fArrayAmps
    for (Int_t i = 0; i < fArrayAmp->GetEntriesFast(); i++ ) {  // loop over data member, i<72
-      TIterator *objListIterator = arrayAmpList->MakeIterator();
+      TIterator *cobjListIterator = arrayAmpList->MakeIterator();
       histList = new TList;
-      while (( objarray =  (TObjArray*)objListIterator->Next() )) { 
+      while (( objarray =  (TObjArray*)cobjListIterator->Next() )) { 
          // loop over arrayAmpList, get TObjArray, get object at position i, cast it into TH1F
          if (!objarray) continue;
          hist = (TH1F*)(objarray->At(i));
@@ -2266,7 +2268,7 @@ Long64_t AliTPCcalibTracks::Merge(TCollection *collectionList) {
       }
       ((TH1F*)(fArrayAmp->At(i)))->Merge(histList);
       delete histList;
-      delete objListIterator;
+      delete cobjListIterator;
    }
    
    if (GetDebugLevel() > 0) cout << "merging fArrayQDY..." << endl;
@@ -2519,7 +2521,7 @@ AliTPCcalibTracks* AliTPCcalibTracks::TestMerge(AliTPCcalibTracks *ct, AliTPCClu
 }
 
 
-void  AliTPCcalibTracks::MakeQPosNormAll(TTree * chainres, AliTPCClusterParam * param, Int_t maxPoints, Int_t verbose){
+void  AliTPCcalibTracks::MakeQPosNormAll(TTree * chainres, AliTPCClusterParam * param, Int_t maxPoints){
   //
   // Make position corrections
   // for the moment Only using debug streamer 
@@ -2546,7 +2548,7 @@ void  AliTPCcalibTracks::MakeQPosNormAll(TTree * chainres, AliTPCClusterParam *
     //1. Load Parameters to be modified:
     //e.g:
     
-    AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
+    AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
     AliCDBManager::Instance()->SetRun(0) 
     AliTPCClusterParam * param = AliTPCcalibDB::Instance()->GetClusterParam();