fix coverity
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Jan 2012 13:47:06 +0000 (13:47 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 4 Jan 2012 13:47:06 +0000 (13:47 +0000)
add momentum monitoring in debug mode for resolution task
add B field sign awareness for resolution task

PWG1/TRD/AliTRDinfoGen.cxx
PWG1/TRD/AliTRDresolution.cxx
PWG1/TRD/AliTRDresolution.h
PWG1/TRD/info/AliTRDtrackInfo.cxx

index 83da7eb..55fc07d 100644 (file)
@@ -668,9 +668,10 @@ void AliTRDinfoGen::UserExec(Option_t *){
     fTrackInfo->Delete("");\r
   }\r
   // read clusters REC info\r
-  TTree * treeR(NULL);\r
-  if(fInputHandler && dynamic_cast<AliESDInputHandlerRP*>(fInputHandler)){\r
-    if((treeR = (dynamic_cast<AliESDInputHandlerRP*>(fInputHandler))->GetTreeR("TRD"))) {\r
+  TTree * treeR(NULL); AliESDInputHandlerRP *esdRPhandler(NULL);\r
+  if(fInputHandler) esdRPhandler = dynamic_cast<AliESDInputHandlerRP*>(fInputHandler);\r
+  if(esdRPhandler){\r
+    if((treeR = esdRPhandler->GetTreeR("TRD"))) {\r
       TObjArray *recPoints(NULL);\r
       if((treeR->GetBranch("TRDcluster"))){\r
         treeR->SetBranchAddress("TRDcluster", &recPoints);\r
index 18cf19f..8d439fd 100644 (file)
@@ -148,7 +148,7 @@ Char_t const * AliTRDresolution::fgPerformanceName[kNclasses] = {
 //    ,"Tracklet2TRDout"
 //    ,"TRDout2MC"
 };
-Float_t AliTRDresolution::fgPtBin[kNpt+1];
+Float_t AliTRDresolution::fgPtBin[25];
 
 //________________________________________________________
 AliTRDresolution::AliTRDresolution()
@@ -159,6 +159,7 @@ AliTRDresolution::AliTRDresolution()
   ,fDyRange(0.75)
   ,fBCbinTOF(0)
   ,fBCbinFill(0)
+  ,fBsign(kFALSE)
   ,fProj(NULL)
   ,fDBPDG(NULL)
   ,fCl(NULL)
@@ -180,6 +181,7 @@ AliTRDresolution::AliTRDresolution(char* name, Bool_t xchange)
   ,fDyRange(0.75)
   ,fBCbinTOF(0)
   ,fBCbinFill(0)
+  ,fBsign(kFALSE)
   ,fProj(NULL)
   ,fDBPDG(NULL)
   ,fCl(NULL)
@@ -648,7 +650,7 @@ TH1* AliTRDresolution::PlotTrackIn(const AliTRDtrackV1 *track)
   val[kPrez]        = dphi*TMath::RadToDeg();
   val[kSpeciesChgRC]= fTracklet->IsRowCross()?0:fSpecies;
   val[kPt]          = fPt<0.8?0:(fPt<1.5?1:2);//GetPtBin(fPt);
-  val[kNdim]        = fTracklet->GetDetector();
+  val[kNdim]        = GetPtBin(fTracklet->GetMomentum());
   val[kNdim+1]      = dx;
   val[kNdim+2]      = fEvent?fEvent->GetBunchFill():0;
   H->Fill(val);
@@ -945,7 +947,7 @@ Int_t AliTRDresolution::GetPtBin(Float_t pt)
 {
 // Find pt bin according to local pt segmentation
   Int_t ipt(-1);
-  while(ipt<AliTRDresolution::kNpt){
+  while(ipt<24){
     if(pt<fgPtBin[ipt+1]) break;
     ipt++;
   }
@@ -1024,7 +1026,7 @@ Bool_t AliTRDresolution::GetRefFigure(Int_t ifig)
 void AliTRDresolution::MakePtSegmentation(Float_t pt0, Float_t dpt)
 {
 // Build pt segments
-  for(Int_t j(0); j<=kNpt; j++){
+  for(Int_t j(0); j<=24; j++){
     pt0+=(TMath::Exp(j*j*dpt)-1.);
     fgPtBin[j]=pt0;
   }
@@ -1048,6 +1050,10 @@ void AliTRDresolution::MakeSummary()
   const Int_t nClViews(9);
   const Char_t *vClName[nClViews] = {"ClY", "ClYn", "ClYp", "ClQn", "ClQp", "ClYXTCp", "ClYXTCn", "ClYXPh", "ClYXPh"};
   const UChar_t vClOpt[nClViews] = {1, 1, 1, 0, 0, 0, 0, 0, 1};
+  const Float_t vClSignMin[2] = {2.6e2, 4.4e2},
+                vClSignMax[2] = {4.4e2, 6.2e2},
+                vClMin[nClViews] = {3.2e2, vClSignMin[Int_t(fBsign)], vClSignMin[Int_t(!fBsign)], 0., 0., 0., 0., 0., 3.2e2},
+                vClMax[nClViews] = {5.e2, vClSignMax[Int_t(fBsign)], vClSignMax[Int_t(!fBsign)], 0., 0., 0., 0., 0., 5.e2};
   const Int_t nTrkltViews(19);
   const Char_t *vTrkltName[nTrkltViews] = {
     "TrkltY", "TrkltYn", "TrkltYp", "TrkltY", "TrkltYn", "TrkltYp",
@@ -1064,7 +1070,7 @@ void AliTRDresolution::MakeSummary()
     0, 0, 0,
     0, 0, 0,
     0, 0, 0,
-    0, 0, 1, 1
+    0, 0, 2, 2
   };
   const Int_t nTrkInViews(5);
   const Char_t *vTrkInName[nTrkInViews][6] = {
@@ -1124,8 +1130,8 @@ void AliTRDresolution::MakeSummary()
           if(!(h2 = (TH2*)arr->FindObject(Form("H%s%s%d_2D", typName[ityp], vClName[iview], iplot)))) continue;
           nplot++;
           if(vClOpt[iview]==0) h2->Draw("colz");
-          else if(vClOpt[iview]==1) DrawSigma(h2, "#sigma(#Deltay) [#mum]", 3.2e2, 5.e2, 1.e4);
-          MakeDetectorPlot(iplot);
+          else if(vClOpt[iview]==1) DrawSigma(h2, "#sigma(#Deltay) [#mum]", vClMin[iview], vClMax[iview], 1.e4);
+          if(iview<3) MakeDetectorPlot(iplot);
         }
         if(nplot==6) cOut->SaveAs(Form("%s.gif", cOut->GetName()));
         else delete cOut;
@@ -1142,7 +1148,8 @@ void AliTRDresolution::MakeSummary()
           if(!(h2 = (TH2*)arr->FindObject(Form("H%s%s%d_2D", typName[ityp], vTrkltName[iview], iplot)))) continue;
           nplot++;
           if(vTrkltOpt[iview]==0) h2->Draw("colz");
-          else DrawSigma(h2, "#sigma(#Deltay) [cm]", .15, .6);
+          else if (vTrkltOpt[iview]==1) DrawSigma(h2, "#sigma(#Deltay) [cm]", .15, .6);
+          else if (vTrkltOpt[iview]==2) DrawSigma(h2, "#sigma(occupancy) [%]", 10.5, 15.);
           MakeDetectorPlot(iplot);
         }
         if(nplot==6){
@@ -1744,6 +1751,7 @@ Bool_t AliTRDresolution::MakeProjectionTracklet(Bool_t mc)
       /*!dphi*/
       if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[ich], ptName[0], 0, ily, 0)))){
         pr0->fH->SetNameTitle(Form("H%sTrkltPh%c%d", mc?"MC":"", chName[ich], ily), Form("Tracklets[%c] :: #Delta#phi Ly[%d]", chSgn[ich], ily));
+        pr0->SetShowRange(-.9,.9);
         if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
         if(ich && (pr1 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[0], ptName[0], 0, ily, 0)))) (*pr1)+=(*pr0);
       }
@@ -1772,13 +1780,16 @@ Bool_t AliTRDresolution::MakeProjectionTracklet(Bool_t mc)
     /*!dphi*/
     if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltPh%c%c%d%d%d", mc?"MC":"", chName[0], ptName[0], 0, ily, 0)))){
       pr0->fH->SetNameTitle(Form("H%sTrkltPh%d", mc?"MC":"", ily), Form("Tracklets :: #Delta#phi Ly[%d]", ily));
+      pr0->SetShowRange(-.45,.45);
       if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
     }
     /*!dQdl*/
     if((pr0 = (AliTRDresolutionProjection*)php.FindObject(Form("H%sTrkltQ%c%c%d%d%d", mc?"MC":"", chName[0], ptName[0], 0, ily, 0)))){
       pr0->fH->SetNameTitle(Form("H%sTrkltQ%d", mc?"MC":"", ily), Form("Tracklets :: dQdl Ly[%d]", ily));
-      if((h2 = pr0->Projection2D(kNstat, kNcontours, 1))) arr->AddAt(h2, jh++);
-      pr0->fH->SetNameTitle(Form("H%sTrkltQS%d", mc?"MC":"", ily), Form("Tracklets :: dQdl Ly[%d]", ily));
+      pr0->SetShowRange(1.,2.3);
+      if((h2 = pr0->Projection2D(kNstat, kNcontours, 2))) arr->AddAt(h2, jh++);
+      pr0->fH->SetName(Form("H%sTrkltQS%d", mc?"MC":"", ily));
+      pr0->SetShowRange(2.4,5.1);
       if((h2 = pr0->Projection2D(kNstat, kNcontours, 0))) arr->AddAt(h2, jh++);
     }
     /*!TB occupancy*/
@@ -2663,7 +2674,7 @@ TObjArray* AliTRDresolution::Histos()
     Double_t trinMin[mdim];  memcpy(trinMin, fgkMin, kNdim*sizeof(Double_t));
     Double_t trinMax[mdim];  memcpy(trinMax, fgkMax, kNdim*sizeof(Double_t));
     trinNbins[kSpeciesChgRC] = Int_t(kNcharge)*AliPID::kSPECIES+1; trinMin[kSpeciesChgRC] = -AliPID::kSPECIES-0.5; trinMax[kSpeciesChgRC] = AliPID::kSPECIES+0.5;
-    trinTitle[kNdim]=StrDup("detector"); trinNbins[kNdim] = 540; trinMin[kNdim] = -0.5; trinMax[kNdim] = 539.5;
+    trinTitle[kNdim]=StrDup("p [GeV/c]"); trinNbins[kNdim] = 24; trinMin[kNdim] = -0.5; trinMax[kNdim] = 23.5;
     trinTitle[kNdim+1]=StrDup("dx [cm]"); trinNbins[kNdim+1]=48; trinMin[kNdim+1]=-2.4; trinMax[kNdim+1]=2.4;
     trinTitle[kNdim+2]=StrDup("Fill Bunch"); trinNbins[kNdim+2]=3500; trinMin[kNdim+2]=-0.5; trinMax[kNdim+2]=3499.5;
     st = "r-#phi/z/angular residuals @ TRD entry;";
index cb3201b..377ef0e 100644 (file)
@@ -69,9 +69,9 @@ public:
     kDetNproj=60       // detector projections
     ,kClNproj=60       // cluster projections
     ,kTrkltNproj=8000  // tracklet projections
-    ,kTrkInNproj=142   // trackIn projections
+    ,kTrkInNproj=240   // trackIn projections
     ,kTrkNproj=2500    // track projections
-    ,kMCTrkInNproj=162 // trackIn projections
+    ,kMCTrkInNproj=260 // trackIn projections
   };
   enum ETRDresolutionProjs {
     kBC    = 0 // bunch cross
@@ -83,9 +83,7 @@ public:
     ,kSpeciesChgRC
     ,kPt
     ,kNdim  // no of dimensions in the THnSparse
-  };
-  enum ETRDresolutionSize {
-     kNdimDet     = 4
+    ,kNdimDet     = 4
     ,kNdimCl      = 4
     ,kNdimTrklt   = 4
     ,kNdimTrkIn   = 7
@@ -139,6 +137,7 @@ public:
   void            SetPtThreshold(Float_t pt)            { fPtThreshold = pt;}
   void            SetBCselectTOF(Int_t b=0)             { fBCbinTOF = b==0?2:(b<0?1:3);}
   void            SetBCselectFill(Int_t b=0)            { fBCbinFill = b<0||b>3499?1:b+1;}
+  void            SetBsign(Int_t b=0)                   { fBsign = Bool_t(b);}
   void            SetRangeZ(TH2 *h2, Float_t m, Float_t M);
   void            SetVerbose(Bool_t v = kTRUE)          { SetBit(kVerbose, v);}
   void            SetVisual(Bool_t v = kTRUE)           { SetBit(kVisual, v);}
@@ -201,12 +200,13 @@ protected:
   Float_t               fDyRange;         // min/max dy
   Int_t                 fBCbinTOF;        // set/select by TOF BC index
   Int_t                 fBCbinFill;       // set/select by Bunch Fill index
+  Bool_t                fBsign;           // sign of magnetic field (kFALSE[-] kTRUE[+])
   static Char_t const  *fgPerformanceName[kNclasses]; //! name of performance plot
   static Int_t const    fgkNbins[kNdim];  //! no of bins/projection
   static Double_t const fgkMin[kNdim];    //! low limits for projections
   static Double_t const fgkMax[kNdim];    //! high limits for projections
   static Char_t const  *fgkTitle[kNdim];  //! title of projection 
-  static Float_t        fgPtBin[kNpt+1];  //! pt segmentation
+  static Float_t        fgPtBin[25];      //! pt segmentation
   TObjArray            *fProj;            //! result holder - sigma values
   TDatabasePDG         *fDBPDG;           //! PDG database
 
index 89c4198..36d5fe5 100644 (file)
@@ -307,13 +307,12 @@ AliTRDtrackInfo::AliESDinfo& AliTRDtrackInfo::AliESDinfo::operator=(const AliESD
   fTOFbc       = esd.fTOFbc;
   fTRDpidQuality= esd.fTRDpidQuality;
   fTRDnSlices  = esd.fTRDnSlices;
-  fTRDslices   = NULL;
   
   memcpy(fTRDr, esd.fTRDr, AliPID::kSPECIES*sizeof(Double32_t));
   memcpy(fTRDv0pid, esd.fTRDv0pid, AliPID::kSPECIES*sizeof(Int_t));
 
   if(fTRDnSlices){
-    fTRDslices = new Double32_t[fTRDnSlices];
+    if(!fTRDslices) fTRDslices = new Double32_t[fTRDnSlices];
     memcpy(fTRDslices, esd.fTRDslices, fTRDnSlices*sizeof(Double32_t));
   }
   if(esd.fOP){