try to fix coverity 24179, 24178, 24125, 24124, check cast to pointers not being...
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDQADataMaker.cxx
index 991e05d..bf94349 100644 (file)
@@ -41,7 +41,7 @@ ClassImp(AliHMPIDQADataMaker)
            
 //____________________________________________________________________________ 
   AliHMPIDQADataMaker::AliHMPIDQADataMaker() : 
-  AliQADataMaker(AliQA::GetDetName(AliQA::kHMPID), "HMPID Quality Assurance Data Maker")
+  AliQADataMaker(AliQAv1::GetDetName(AliQAv1::kHMPID), "HMPID Quality Assurance Data Maker")
 {
   // ctor
 }
@@ -68,41 +68,45 @@ AliHMPIDQADataMaker& AliHMPIDQADataMaker::operator = (const AliHMPIDQADataMaker&
 void AliHMPIDQADataMaker::InitHits()
 {
   // create Hits histograms in Hits subdir
-     TH1F *hHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC",500,0,4000);
-     Add2HitsList(hHitQdc,0);
-     TH2F *hHitMap[7];
-     for(Int_t iCh=0;iCh<7;iCh++) {
-     hHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit}",iCh),162,-1,161,146,-1,145);   
+  TH1F *hHitQdc=new TH1F("HitQdc","HMPID Hit Qdc all chamber;QDC",500,0,4000);
+  Add2HitsList(hHitQdc,0);
+  TH2F *hHitMap[7];
+  for(Int_t iCh=0;iCh<7;iCh++) {
+    hHitMap[iCh]=new TH2F(Form("HMPID HitMap%i",iCh),Form("Ch%i;x_{Hit};y_{Hit}",iCh),162,-1,161,146,-1,145);   
     Add2HitsList(hHitMap[iCh],iCh+1);
-    }
-
+  }
+  //
+  ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line  
 }
 
 //____________________________________________________________________________ 
 void AliHMPIDQADataMaker::InitDigits()
 {
   // create Digits histograms in Digits subdir
-      TH1F *hDigPcEvt = new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
-      TH1F *hDigQ     = new TH1F("Q        ","Charge of digits (ADC)     ",3000,0,3000);
-      TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
-
-      TProfile *tDigHighQ = new TProfile("tDigHighQ","Highest charge in chamber  ",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
-      TProfile *tDigChEvt = new TProfile("tDigChEvt","Chamber occupancy per event (profile)",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
-
-Add2DigitsList(hDigPcEvt,0);
-Add2DigitsList(hDigQ    ,1);
-Add2DigitsList(hDigChEvt,2);
-Add2DigitsList(tDigHighQ,3);
-Add2DigitsList(tDigChEvt,4);
+  TH1F *hDigPcEvt = new TH1F("hDigPcEvt","PC occupancy",156,-1,77);
+  TH1F *hDigQ     = new TH1F("Q        ","Charge of digits (ADC)     ",3000,0,3000);
+  TH1F *hDigChEvt = new TH1F("hDigChEvt","Chamber occupancy per event",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
+  
+  TProfile *tDigHighQ = new TProfile("tDigHighQ","Highest charge in chamber  ",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
+  TProfile *tDigChEvt = new TProfile("tDigChEvt","Chamber occupancy per event (profile)",AliHMPIDParam::kMaxCh+1,AliHMPIDParam::kMinCh,AliHMPIDParam::kMaxCh+1);
+  
+  Add2DigitsList(hDigPcEvt,0);
+  Add2DigitsList(hDigQ    ,1);
+  Add2DigitsList(hDigChEvt,2);
+  Add2DigitsList(tDigHighQ,3);
+  Add2DigitsList(tDigChEvt,4);
+  //
+  ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
 void AliHMPIDQADataMaker::InitSDigits()
 {
   // create SDigits histograms in SDigits subdir
-   TH1F   *hSDigits     = new TH1F("hHmpidSDigits",    "SDigits Q  distribution in HMPID",  500, 0., 5000.) ; 
-
-Add2SDigitsList(hSDigits,0);
+  TH1F   *hSDigits     = new TH1F("hHmpidSDigits",    "SDigits Q  distribution in HMPID",  500, 0., 5000.) ; 
+  Add2SDigitsList(hSDigits,0);
+  //
+  ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -122,14 +126,16 @@ void AliHMPIDQADataMaker::InitRecPoints()
   Add2RecPointsList(hCluFlg , 2);
   Add2RecPointsList(hCluSize, 3);
   Add2RecPointsList(hCluQ   , 4);
+  //
+  ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
 }
 //____________________________________________________________________________
 
 void AliHMPIDQADataMaker::InitRaws()
 {
-//
-// Booking QA histo for Raw data
-//
+  //
+  // Booking QA histo for Raw data
+  //
   TH1F *hqPad[14];
   for(Int_t iddl =0; iddl<14; iddl++) {
   hqPad[iddl] = new TH1F(Form("hqPadDDL%i",iddl), Form("Pad Q Entries at DDL %i",iddl), 500,0,5000);
@@ -147,7 +153,9 @@ void AliHMPIDQADataMaker::InitRaws()
   hSumErr->GetXaxis()->SetBinLabel((2*ilabel+1),Form("%i  %s",ilabel+1,hnames[ilabel]));
 
   }
-Add2RawsList(hSumErr,14);
+  Add2RawsList(hSumErr,14);
+  //
+  ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
 }
 
 //____________________________________________________________________________
@@ -155,22 +163,24 @@ void AliHMPIDQADataMaker::InitESDs()
 {
   //
   //Booking ESDs histograms
-   TH2F*  hCkovP  = new TH2F("CkovP" , "#theta_{c}, [rad];P, [GeV]"   , 150,      0,  7  ,100, 0, 1)   ;
-   TH2F*  hSigP   = new TH2F("SigP"  ,"#sigma_{#theta_c} [mrad];[GeV]", 150,      0,  7  ,100, 0, 1)   ;
-   TH2F*  hMipXY  = new TH2F("MipXY" ,"mip position"                  , 260,      0,130  ,252, 0,126)  ;
-   TH2F*  hDifXY  = new TH2F("DifXY" ,"diff"                          , 200,    -10, 10  ,200,-10,10)  ;
-   TH1F*  hPid[5];
-   hPid[0] = new TH1F("PidE" ,"electron response"              , 101, -0.005,1.005)             ;
-   hPid[1] = new TH1F("PidMu","#mu response"                   , 101, -0.005,1.005)             ;
-   hPid[2] = new TH1F("PidPi","#pi response"                   , 101, -0.005,1.005)             ;
-   hPid[3] = new TH1F("PidK" ,"K response"                     , 101, -0.005,1.005)             ;
-   hPid[4] = new TH1F("PidP" ,"p response"                         ,101, -0.005,1.005)             ;
-
-Add2ESDsList(hCkovP,0);
-Add2ESDsList(hSigP ,1);
-Add2ESDsList(hMipXY,2);
-Add2ESDsList(hDifXY,3);
-for(Int_t i=0; i< 5; i++) Add2ESDsList(hPid[i],i+4);
+  TH2F*  hCkovP  = new TH2F("CkovP" , "#theta_{c}, [rad];P, [GeV]"   , 150,      0,  7  ,100, 0, 1)   ;
+  TH2F*  hSigP   = new TH2F("SigP"  ,"#sigma_{#theta_c} [mrad];[GeV]", 150,      0,  7  ,100, 0, 1)   ;
+  TH2F*  hMipXY  = new TH2F("MipXY" ,"mip position"                  , 260,      0,130  ,252, 0,126)  ;
+  TH2F*  hDifXY  = new TH2F("DifXY" ,"diff"                          , 200,    -10, 10  ,200,-10,10)  ;
+  TH1F*  hPid[5];
+  hPid[0] = new TH1F("PidE" ,"electron response"              , 101, -0.005,1.005)             ;
+  hPid[1] = new TH1F("PidMu","#mu response"                   , 101, -0.005,1.005)             ;
+  hPid[2] = new TH1F("PidPi","#pi response"                   , 101, -0.005,1.005)             ;
+  hPid[3] = new TH1F("PidK" ,"K response"                     , 101, -0.005,1.005)             ;
+  hPid[4] = new TH1F("PidP" ,"p response"                         ,101, -0.005,1.005)             ;
+  
+  Add2ESDsList(hCkovP,0);
+  Add2ESDsList(hSigP ,1);
+  Add2ESDsList(hMipXY,2);
+  Add2ESDsList(hDifXY,3);
+  for(Int_t i=0; i< 5; i++) Add2ESDsList(hPid[i],i+4);
+  //
+  ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
 }
 //____________________________________________________________________________
 
@@ -186,11 +196,11 @@ void AliHMPIDQADataMaker::MakeHits(TClonesArray * data)
     TIter next(hits); 
     AliHMPIDHit * hit ; 
     while ( (hit = dynamic_cast<AliHMPIDHit *>(next())) ) {
-      if(hit->Pid()<500000) GetHitsData(0)->Fill(hit->Q()) ;
-      if(hit->Pid()<500000) GetHitsData(hit->Ch()+1)->Fill(hit->LorsX(),hit->LorsY());
+      if(hit->Pid()<500000) FillHitsData(0,hit->Q()) ;
+      if(hit->Pid()<500000) FillHitsData(hit->Ch()+1,hit->LorsX(),hit->LorsY());
     }
   } 
-
+  //
 }
 //___________________________________________________________________________
 void AliHMPIDQADataMaker::MakeHits(TTree * data)
@@ -203,7 +213,12 @@ void AliHMPIDQADataMaker::MakeHits(TTree * data)
     data->GetEntry(iEnt);
     MakeHits(pHits);
   }//entries loop
+  //
+  IncEvCountCycleHits();
+  IncEvCountTotalHits();
+  //
 }
+
 //____________________________________________________________________________
 void AliHMPIDQADataMaker::MakeDigits(TClonesArray * data)
 {
@@ -217,18 +232,17 @@ void AliHMPIDQADataMaker::MakeDigits(TClonesArray * data)
     for(Int_t i =0; i< chamber->GetEntries(); i++)
       {
        TClonesArray * digits = dynamic_cast<TClonesArray*>(chamber->At(i)); 
-       GetDigitsData(2)->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
-        GetDigitsData(4)->Fill(i,digits->GetEntriesFast()/(48.*80.*6.));
+       FillDigitsData(2,i,digits->GetEntriesFast()/(48.*80.*6.));
+        FillDigitsData(4,i,digits->GetEntriesFast()/(48.*80.*6.));
         Double_t highQ=0;
        TIter next(digits); 
        AliHMPIDDigit * digit; 
        while ( (digit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
-         GetDigitsData(0)->Fill(10.*i+digit->Pc(),1./(48.*80.));
-         GetDigitsData(1)->Fill(digit->Q());
+         FillDigitsData(0,10.*i+digit->Pc(),1./(48.*80.));
+         FillDigitsData(1,digit->Q());
           if(digit->Q()>highQ) highQ = digit->Q();
        }  
-      GetDigitsData(3)->Fill(i,highQ);
+       FillDigitsData(3,i,highQ);      
       }
   }
 }
@@ -251,8 +265,13 @@ void AliHMPIDQADataMaker::MakeDigits(TTree * data)
   }
   data->GetEntry(0);
 
-   MakeDigits((TClonesArray *)pObjDig);
+  MakeDigits((TClonesArray *)pObjDig);
+  //
+  IncEvCountCycleDigits();
+  IncEvCountTotalDigits();
+  //
 }
+
 //____________________________________________________________________________
 
 void AliHMPIDQADataMaker::MakeRaws(AliRawReader *rawReader)
@@ -263,15 +282,14 @@ void AliHMPIDQADataMaker::MakeRaws(AliRawReader *rawReader)
   for(Int_t iCh=AliHMPIDParam::kMinCh;iCh<=AliHMPIDParam::kMaxCh;iCh++) {
     AliHMPIDRawStream stream(rawReader);
     while(stream.Next())
-    {
-
+      {
       UInt_t ddl=stream.GetDDLNumber(); //returns 0,1,2 ... 13
       if((UInt_t)(2*iCh)==ddl || (UInt_t)(2*iCh+1)==ddl) {
        for(Int_t row = 1; row <= AliHMPIDRawStream::kNRows; row++){
         for(Int_t dil = 1; dil <= AliHMPIDRawStream::kNDILOGICAdd; dil++){
           for(Int_t pad = 0; pad < AliHMPIDRawStream::kNPadAdd; pad++){
             if(stream.GetCharge(ddl,row,dil,pad) < 1) continue;
-              GetRawsData(ddl)->Fill(stream.GetCharge(ddl,row,dil,pad));
+              FillRawsData(ddl,stream.GetCharge(ddl,row,dil,pad));
 //              Printf("charge %i",stream.GetCharge(ddl,row,dil,pad));
             }//pad
           }//dil
@@ -281,12 +299,16 @@ void AliHMPIDQADataMaker::MakeRaws(AliRawReader *rawReader)
     for(Int_t iErr =1; iErr<(Int_t)AliHMPIDRawStream::kSumErr; iErr++){
       Int_t errflag = stream.GetErrors(iErr);
 
-       if(errflag < 0) GetRawsData(14)->Fill((Int_t)AliHMPIDRawStream::kSumErr+0.5);
-       else if(errflag == 0) GetRawsData(14)->Fill((Int_t)AliHMPIDRawStream::kSumErr-0.5);
-       else GetRawsData(14)->Fill(iErr-0.5);
+       if(errflag < 0) FillRawsData(14,(Int_t)AliHMPIDRawStream::kSumErr+0.5);
+       else if(errflag == 0) FillRawsData(14,(Int_t)AliHMPIDRawStream::kSumErr-0.5);
+       else FillRawsData(14,iErr-0.5);
      }
     stream.Delete();
   }//chamber loop
+  //
+  IncEvCountCycleRaws();
+  IncEvCountTotalRaws();
+  //
 }
 
 //___________________________________________________________________________
@@ -303,17 +325,17 @@ void AliHMPIDQADataMaker::MakeSDigits(TClonesArray * data)
     TIter next(sdigits) ; 
     AliHMPIDDigit * sdigit ; 
     while ( (sdigit = dynamic_cast<AliHMPIDDigit *>(next())) ) {
-           GetSDigitsData(0)->Fill(sdigit->Q());
+           FillSDigitsData(0,sdigit->Q());
     } 
   }
 }
 //___________________________________________________________________________
 void AliHMPIDQADataMaker::MakeSDigits(TTree * data)
 {
- //
- // Opening the SDigit Tree
- //
- TClonesArray * sdigits = new TClonesArray("AliHMPIDDigit", 1000) ;
+  //
+  // Opening the SDigit Tree
+  //
+  TClonesArray * sdigits = new TClonesArray("AliHMPIDDigit", 1000) ;
 
   TBranch * branch = data->GetBranch("HMPID") ;
   if ( ! branch ) {
@@ -323,6 +345,10 @@ void AliHMPIDQADataMaker::MakeSDigits(TTree * data)
   branch->SetAddress(&sdigits) ;
   branch->GetEntry(0) ;
   MakeSDigits(sdigits) ;
+  //
+  IncEvCountCycleSDigits();
+  IncEvCountTotalSDigits();
+  //
 }
 //____________________________________________________________________________
 void AliHMPIDQADataMaker::MakeRecPoints(TTree * clustersTree)
@@ -336,19 +362,22 @@ void AliHMPIDQADataMaker::MakeRecPoints(TTree * clustersTree)
     branch->SetAddress(&clusters);
     branch->GetEntry(0);
 
-    GetRecPointsData(0)->Fill(i,clusters->GetEntries());
+    FillRecPointsData(0,i,clusters->GetEntries());
     TIter next(clusters);
     AliHMPIDCluster *clu;
     while ( (clu = dynamic_cast<AliHMPIDCluster *>(next())) ) {
-      GetRecPointsData(1)->Fill(clu->Chi2());
-      GetRecPointsData(2)->Fill(clu->Status());
-      GetRecPointsData(3)->Fill(clu->Size());
-      GetRecPointsData(4)->Fill(clu->Q()); 
+      FillRecPointsData(1,clu->Chi2());
+      FillRecPointsData(2,clu->Status());
+      FillRecPointsData(3,clu->Size());
+      FillRecPointsData(4,clu->Q()); 
     }
   }
 
   clusters->Delete();
   delete clusters;
+  IncEvCountCycleRecPoints();
+  IncEvCountTotalRecPoints();
+  //
 }
 
 //____________________________________________________________________________
@@ -359,19 +388,25 @@ void AliHMPIDQADataMaker::MakeESDs(AliESDEvent * esd)
   //
   for(Int_t iTrk = 0 ; iTrk < esd->GetNumberOfTracks() ; iTrk++){
     AliESDtrack *pTrk = esd->GetTrack(iTrk) ;
-    GetESDsData(0)->Fill(pTrk->GetP(),pTrk->GetHMPIDsignal());
-    GetESDsData(1)->Fill( pTrk->GetP(),TMath::Sqrt(pTrk->GetHMPIDchi2()));
+    Float_t thetaCkov = -999.;
+    if(pTrk->GetHMPIDsignal()<0.) thetaCkov = pTrk->GetHMPIDsignal();
+    else                          thetaCkov = pTrk->GetHMPIDsignal() - (Int_t)pTrk->GetHMPIDsignal();;
+    FillESDsData(0,pTrk->GetP(),thetaCkov);
+    FillESDsData(1, pTrk->GetP(),TMath::Sqrt(pTrk->GetHMPIDchi2()));
     Float_t xm,ym; Int_t q,np;  
     pTrk->GetHMPIDmip(xm,ym,q,np);                       //mip info
-    GetESDsData(2)->Fill(xm,ym);
+    FillESDsData(2,xm,ym);
     Float_t xRad,yRad,th,ph;        
     pTrk->GetHMPIDtrk(xRad,yRad,th,ph);              //track info at the middle of the radiator
     Float_t xPc = xRad+9.25*TMath::Tan(th)*TMath::Cos(ph); // temporar: linear extrapol (B=0!)
     Float_t yPc = yRad+9.25*TMath::Tan(th)*TMath::Sin(ph); // temporar:          "
-    GetESDsData(3)->Fill(xm-xPc,ym-yPc); //track info
+    FillESDsData(3,xm-xPc,ym-yPc); //track info
     Double_t pid[5] ;      pTrk->GetHMPIDpid(pid) ;
-    for(Int_t i = 0 ; i < 5 ; i++) GetESDsData(4+i)->Fill(pid[i]) ;
+    for(Int_t i = 0 ; i < 5 ; i++) FillESDsData(4+i,pid[i]) ;
   }
+  IncEvCountCycleESDs();
+  IncEvCountTotalESDs();
+  //
 }
 //____________________________________________________________________________
 void AliHMPIDQADataMaker::StartOfDetectorCycle()
@@ -380,10 +415,10 @@ void AliHMPIDQADataMaker::StartOfDetectorCycle()
   
 }
 
-void AliHMPIDQADataMaker::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray * obj)
+void AliHMPIDQADataMaker::EndOfDetectorCycle(AliQAv1::TASKINDEX task, TObjArray * obj)
 {
   //Detector specific actions at end of cycle
   // do the QA checking
-//  AliQAChecker::Instance()->Run(AliQA::kHMPID, task, obj) ;  
+//  AliQAChecker::Instance()->Run(AliQAv1::kHMPID, task, obj) ;  
 }