store also difference in local Y
[u/mrichter/AliRoot.git] / ITS / AliITSQASPDDataMakerSim.cxx
index 5b9c287..2dbe1d4 100644 (file)
@@ -57,6 +57,14 @@ fGenOffsetS(0),
 fGenOffsetD(0)
 {
   //ctor used to discriminate OnLine-Offline analysis   
+  fGenOffsetH=  new Int_t[AliRecoParam::kNSpecies];                       
+  fGenOffsetS=  new Int_t[AliRecoParam::kNSpecies];                           
+  fGenOffsetD=  new Int_t[AliRecoParam::kNSpecies];
+  for(Int_t i=0; i<AliRecoParam::kNSpecies; i++) {
+    fGenOffsetH[i]= 0;
+    fGenOffsetS[i]= 0;
+    fGenOffsetD[i]= 0;
+  }             
 }
 
 //____________________________________________________________________________ 
@@ -73,7 +81,8 @@ fGenOffsetD(qadm.fGenOffsetD)
   //copy ctor 
   fAliITSQADataMakerSim->SetName((const char*)qadm.fAliITSQADataMakerSim->GetName()) ; 
   fAliITSQADataMakerSim->SetTitle((const char*)qadm.fAliITSQADataMakerSim->GetTitle());
-  }
+
+}
 
 //__________________________________________________________________
 AliITSQASPDDataMakerSim& AliITSQASPDDataMakerSim::operator = (const AliITSQASPDDataMakerSim& qac )
@@ -88,65 +97,68 @@ AliITSQASPDDataMakerSim& AliITSQASPDDataMakerSim::operator = (const AliITSQASPDD
 void AliITSQASPDDataMakerSim::StartOfDetectorCycle()
 {
   //Detector specific actions at start of cycle
-  AliDebug(1,"AliITSQADM::Start of SPD Cycle\n");
+  AliDebug(AliQAv1::GetQADebugLevel(),"AliITSQADM::Start of SPD Cycle\n");
 }
 
 //____________________________________________________________________________ 
-void AliITSQASPDDataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray* /*list*/)
+void AliITSQASPDDataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t /*task*/, TObjArray** /*list*/)
 {
   // launch the QA checking
-  AliDebug(1,"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n"); 
+  AliDebug(AliQAv1::GetQADebugLevel(),"AliITSDM instantiates checker with Run(AliQAv1::kITS, task, list)\n"); 
   
   //AliQAChecker::Instance()->Run( AliQAv1::kITS , task, list);
 }
 
 //____________________________________________________________________________ 
-void AliITSQASPDDataMakerSim::InitDigits()
+Int_t AliITSQASPDDataMakerSim::InitDigits()
 { 
   // Initialization for DIGIT data - SPD -
-  fGenOffsetD = (fAliITSQADataMakerSim->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ;
+  Int_t rv = 0 ; 
+  //fGenOffsetD = (fAliITSQADataMakerSim->fDigitsQAList[AliRecoParam::kDefault])->GetEntries();
   //fSPDhDTask must be incremented by one unit every time a histogram is ADDED to the QA List
 
-  Char_t name[50];
-  Char_t title[50];
+  Char_t name[51];
+  Char_t title[51];
 
   TH1F *hlayer = new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
   hlayer->GetXaxis()->SetTitle("Layer number");
   hlayer->GetYaxis()->SetTitle("Entries");
-  fAliITSQADataMakerSim->Add2DigitsList(hlayer,fGenOffsetD,kTRUE);
+  rv = fAliITSQADataMakerSim->Add2DigitsList(hlayer,fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()], expert, !image);
   fSPDhDTask++;
   
   TH1F **hmod = new TH1F*[2];
   for (Int_t iLay=0; iLay<2; iLay++) {
-    sprintf(name,"SPDModPattern_SPD%d",iLay+1);
-    sprintf(title,"Module map - SPD Layer %d",iLay+1);
+    snprintf(name,50,"SPDModPattern_SPD%d",iLay+1);
+    snprintf(title,50,"Module map - SPD Layer %d",iLay+1);
     hmod[iLay]=new TH1F(name,title,240,0,240);
     hmod[iLay]->GetXaxis()->SetTitle("Module number");
     hmod[iLay]->GetYaxis()->SetTitle("Entries");
-    fAliITSQADataMakerSim->Add2DigitsList(hmod[iLay],1+iLay+fGenOffsetD);
+    rv = fAliITSQADataMakerSim->Add2DigitsList(hmod[iLay],1+iLay+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()], !expert, image);
     fSPDhDTask++;
   }
   
   TH1F *hcolumns = new TH1F("SPDColumns_SPD","Columns - SPD",160,0.,160.);
   hcolumns->GetXaxis()->SetTitle("Column number");
   hcolumns->GetYaxis()->SetTitle("Entries");
-  fAliITSQADataMakerSim->Add2DigitsList(hcolumns,3+fGenOffsetD,kTRUE);
+  fAliITSQADataMakerSim->Add2DigitsList(hcolumns,3+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()], expert, !image);
   fSPDhDTask++;
 
   TH1F *hrows = new TH1F("SPDRows_SPD","Rows - SPD",256,0.,256.);
   hrows->GetXaxis()->SetTitle("Row number");
   hrows->GetYaxis()->SetTitle("Entries");
-  fAliITSQADataMakerSim->Add2DigitsList(hrows,4+fGenOffsetD,kTRUE);
+  rv = fAliITSQADataMakerSim->Add2DigitsList(hrows,4+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()], expert, !image);
   fSPDhDTask++;
 
   TH1F** hMultSPDdigits = new TH1F*[2];
   for (Int_t iLay=0; iLay<2; ++iLay) {
-    sprintf(name,"SPDDigitMultiplicity_SPD%d",iLay+1);
-    sprintf(title,"Digit multiplicity - SPD Layer %d",iLay+1);
+    snprintf(name,50,"SPDDigitMultiplicity_SPD%d",iLay+1);
+    snprintf(title,50,"Digit multiplicity - SPD Layer %d",iLay+1);
     hMultSPDdigits[iLay]=new TH1F(name,title,200,0.,200.);
     hMultSPDdigits[iLay]->GetXaxis()->SetTitle("Digit multiplicity");
     hMultSPDdigits[iLay]->GetYaxis()->SetTitle("Entries");
-    fAliITSQADataMakerSim->Add2DigitsList(hMultSPDdigits[iLay], 5+iLay+fGenOffsetD);
+    rv = fAliITSQADataMakerSim->Add2DigitsList(hMultSPDdigits[iLay], 5+iLay+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()], !expert, image);
     fSPDhDTask++;
   }
 
@@ -154,17 +166,21 @@ void AliITSQASPDDataMakerSim::InitDigits()
        = new TH2F("SPDDigitMultCorrelation_SPD","Digit multiplicity correlation - SPD",200,0.,200.,200,0.,200.);
   hMultSPDdig2MultSPDdig1->GetXaxis()->SetTitle("Digit multiplicity (Layer 1)");
   hMultSPDdig2MultSPDdig1->GetYaxis()->SetTitle("Digit multiplicity (Layer 2)");
-  fAliITSQADataMakerSim->Add2DigitsList(hMultSPDdig2MultSPDdig1,7+fGenOffsetD);
+  rv = fAliITSQADataMakerSim->Add2DigitsList(hMultSPDdig2MultSPDdig1,7+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()], !expert, image);
   fSPDhDTask++;
 
-  AliDebug(1,Form("%d SPD Digits histograms booked\n",fSPDhDTask));
-
+  AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD Digits histograms booked\n",fSPDhDTask));
+  delete [] hmod;
+  delete [] hMultSPDdigits;
+  return rv ; 
 }
 
 //____________________________________________________________________________
-void AliITSQASPDDataMakerSim::MakeDigits(TTree *digits)
+Int_t AliITSQASPDDataMakerSim::MakeDigits(TTree *digits)
 { 
   // Fill QA for DIGIT - SPD -
+  Int_t rv = 0 ; 
   AliITS *fITS  = (AliITS*)gAlice->GetModule("ITS");
   fITS->SetTreeAddress();
   TClonesArray *iITSdigits  = fITS->DigitsAddress(0);  // 0->SPD
@@ -176,88 +192,103 @@ void AliITSQASPDDataMakerSim::MakeDigits(TTree *digits)
     digits->GetEvent(imod);
     Int_t ndigits = iITSdigits->GetEntries();
     if (imod<80) {
-      fAliITSQADataMakerSim->GetDigitsData(0+fGenOffsetD)->Fill(0.5,ndigits);
-      fAliITSQADataMakerSim->GetDigitsData(1+fGenOffsetD)->Fill(imod,ndigits);
+      fAliITSQADataMakerSim->FillDigitsData(0+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()],0.5,ndigits);
+      fAliITSQADataMakerSim->FillDigitsData(1+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()],imod,ndigits);
       nDigitsL1+=ndigits;
     }
     else {
-      fAliITSQADataMakerSim->GetDigitsData(0+fGenOffsetD)->Fill(1,ndigits);
-      fAliITSQADataMakerSim->GetDigitsData(2+fGenOffsetD)->Fill(imod,ndigits);
+      fAliITSQADataMakerSim->FillDigitsData(0+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()],1,ndigits);
+      fAliITSQADataMakerSim->FillDigitsData(2+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()],imod,ndigits);
       nDigitsL2+=ndigits;
     }
     for (Int_t idig=0; idig<ndigits; ++idig) {
       AliITSdigit *dig=(AliITSdigit*)iITSdigits->UncheckedAt(idig);
       Int_t col=dig->GetCoord1();  // cell number z
       Int_t row=dig->GetCoord2();  // cell number x
-      fAliITSQADataMakerSim->GetDigitsData(3+fGenOffsetD)->Fill(col);
-      fAliITSQADataMakerSim->GetDigitsData(4+fGenOffsetD)->Fill(row);
+      fAliITSQADataMakerSim->FillDigitsData(3+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()],col);
+      fAliITSQADataMakerSim->FillDigitsData(4+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()],row);
     }
   }
-  fAliITSQADataMakerSim->GetDigitsData(5+fGenOffsetD)->Fill(nDigitsL1);
-  fAliITSQADataMakerSim->GetDigitsData(6+fGenOffsetD)->Fill(nDigitsL2);
-  fAliITSQADataMakerSim->GetDigitsData(7+fGenOffsetD)->Fill(nDigitsL1,nDigitsL2);
+  fAliITSQADataMakerSim->FillDigitsData(5+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()],nDigitsL1);
+  fAliITSQADataMakerSim->FillDigitsData(6+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()],nDigitsL2);
+  fAliITSQADataMakerSim->FillDigitsData(7+fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()],nDigitsL1,nDigitsL2);
+  //
+  return rv ; 
 }
 
 //____________________________________________________________________________ 
-void AliITSQASPDDataMakerSim::InitSDigits()
+Int_t AliITSQASPDDataMakerSim::InitSDigits()
 { 
   // Initialization for SDIGIT data - SPD -
-  fGenOffsetS = (fAliITSQADataMakerSim->fSDigitsQAList[AliRecoParam::kDefault])->GetEntries();
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ;
+  Int_t rv = 0 ; 
+  //fGenOffsetS = (fAliITSQADataMakerSim->fSDigitsQAList[AliRecoParam::kDefault])->GetEntries();
   //printf("--W-- AliITSQASPDDataMakerSim::InitSDigits()  fGenOffset= %d \n",fGenOffset);
   //fSPDhSTask must be incremented by one unit every time a histogram is ADDED to the QA List
   
-  Char_t name[50];
-  Char_t title[50];
+  Char_t name[51];
+  Char_t title[51];
 
   TH1F *hlayer = new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
   hlayer->GetXaxis()->SetTitle("Layer number");
   hlayer->GetYaxis()->SetTitle("Entries");
-  fAliITSQADataMakerSim->Add2SDigitsList(hlayer,fGenOffsetS,kTRUE);
+  rv = fAliITSQADataMakerSim->Add2SDigitsList(hlayer,fGenOffsetS[fAliITSQADataMakerSim->GetEventSpecie()], expert, !image);
   fSPDhSTask++;
 
   TH1F **hmod = new TH1F*[2];
   for (Int_t iLay=0; iLay<2; ++iLay) {
-    sprintf(name,"SPDModPattern_SPD%d",iLay+1);
-    sprintf(title,"Module map - SPD Layer %d",iLay+1);
+    snprintf(name,50,"SPDModPattern_SPD%d",iLay+1);
+    snprintf(title,50,"Module map - SPD Layer %d",iLay+1);
     hmod[iLay]=new TH1F(name,title,240,0,240);
     hmod[iLay]->GetXaxis()->SetTitle("Module number");
     hmod[iLay]->GetYaxis()->SetTitle("Entries");
-    fAliITSQADataMakerSim->Add2SDigitsList(hmod[iLay],1+iLay+fGenOffsetS);
+    rv = fAliITSQADataMakerSim->Add2SDigitsList(hmod[iLay],1+iLay+fGenOffsetS[fAliITSQADataMakerSim->GetEventSpecie()], !expert, image);
     fSPDhSTask++;
   }
 
-  AliDebug(1,Form("%d SPD SDigits histograms booked\n",fSPDhSTask));
-
+  AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD SDigits histograms booked\n",fSPDhSTask));
+  delete [] hmod;
+  return rv ; 
 }
 
 //____________________________________________________________________________
-void AliITSQASPDDataMakerSim::MakeSDigits(TTree *sdigits)
+Int_t AliITSQASPDDataMakerSim::MakeSDigits(TTree *sdigits)
 { 
   // Fill QA for SDIGIT - SPD -
+  Int_t rv = 0 ; 
+  static TClonesArray * sdig ; 
+  if (! sdig )
+    sdig = new TClonesArray( "AliITSpListItem",1000 );
+  
   TBranch *brchSDigits = sdigits->GetBranch("ITS");
   for (Int_t imod=0; imod<240; ++imod){
-    TClonesArray * sdig = new TClonesArray( "AliITSpListItem",1000 );
     brchSDigits->SetAddress( &sdig );
     brchSDigits->GetEvent(imod);
     Int_t nsdig=sdig->GetEntries();
     if (imod<80) {
-      fAliITSQADataMakerSim->GetSDigitsData(0+fGenOffsetS)->Fill(0.5,nsdig);
-      fAliITSQADataMakerSim->GetSDigitsData(1+fGenOffsetS)->Fill(imod,nsdig);
+      fAliITSQADataMakerSim->FillSDigitsData(0+fGenOffsetS[fAliITSQADataMakerSim->GetEventSpecie()],0.5,nsdig);
+      fAliITSQADataMakerSim->FillSDigitsData(1+fGenOffsetS[fAliITSQADataMakerSim->GetEventSpecie()],imod,nsdig);
     }
     else {
-      fAliITSQADataMakerSim->GetSDigitsData(0+fGenOffsetS)->Fill(1,nsdig);
-      fAliITSQADataMakerSim->GetSDigitsData(2+fGenOffsetS)->Fill(imod,nsdig);
+      fAliITSQADataMakerSim->FillSDigitsData(0+fGenOffsetS[fAliITSQADataMakerSim->GetEventSpecie()],1,nsdig);
+      fAliITSQADataMakerSim->FillSDigitsData(2+fGenOffsetS[fAliITSQADataMakerSim->GetEventSpecie()],imod,nsdig);
     }
-    delete sdig;
+    sdig->Clear() ;
   }
-
+  //
+  return rv ; 
 }
 
 //____________________________________________________________________________ 
-void AliITSQASPDDataMakerSim::InitHits()
+Int_t AliITSQASPDDataMakerSim::InitHits()
 { 
   // Initialization for HITS data - SPD -
-  fGenOffsetH = (fAliITSQADataMakerSim->fHitsQAList[AliRecoParam::kDefault])->GetEntries();
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ;
+  Int_t rv = 0 ; 
+  
+  //fGenOffsetH = (fAliITSQADataMakerSim->fHitsQAList[AliRecoParam::kDefault])->GetEntries();
   //printf("--W-- AliITSQASPDDataMakerSim::InitHits()  fGenOffset= %d \n",fGenOffset);
   //fSPDhHTask must be incremented by one unit every time a histogram is ADDED to the QA List
   Char_t name[50];
@@ -266,40 +297,43 @@ void AliITSQASPDDataMakerSim::InitHits()
   TH1F *hlayer = new TH1F("SPDLayPattern_SPD","Layer map - SPD",6,0.,6.);
   hlayer->GetXaxis()->SetTitle("Layer number");
   hlayer->GetYaxis()->SetTitle("Entries");
-  fAliITSQADataMakerSim->Add2HitsList(hlayer,fGenOffsetH,kTRUE);
+  rv = fAliITSQADataMakerSim->Add2HitsList(hlayer,fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()], expert, !image);
   fSPDhHTask++;
 
   TH1F **hmod = new TH1F*[2];
   for (Int_t iLay=0; iLay<2; ++iLay) {
-    sprintf(name,"SPDModPattern_SPD%d",iLay+1);
-    sprintf(title,"Module map - SPD Layer %d",iLay+1);
+    snprintf(name,49,"SPDModPattern_SPD%d",iLay+1);
+    snprintf(title,49,"Module map - SPD Layer %d",iLay+1);
     hmod[iLay]=new TH1F(name,title,240,0,240);
     hmod[iLay]->GetXaxis()->SetTitle("Module number");
     hmod[iLay]->GetYaxis()->SetTitle("Entries");
-    fAliITSQADataMakerSim->Add2HitsList(hmod[iLay],1+iLay+fGenOffsetH);
+    rv = fAliITSQADataMakerSim->Add2HitsList(hmod[iLay],1+iLay+fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()], !expert, image);
     fSPDhHTask++;
   }
 
-  TH1F *hhitlenght = new TH1F("SPDLenght_SPD","Hit lenght along y_{loc} coord",210,0.,210.);
+  TH1F *hhitlenght = new TH1F("SPDLenght_SPD","SPD Hit lenght along y_{loc} coord",210,0.,210.);
   hhitlenght->GetXaxis()->SetTitle("Hit lenght [#mum]");
   hhitlenght->GetYaxis()->SetTitle("# hits");
-  fAliITSQADataMakerSim->Add2HitsList(hhitlenght,3+fGenOffsetH);
+  rv = fAliITSQADataMakerSim->Add2HitsList(hhitlenght,3+fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()], !expert, image);
   fSPDhHTask++;
 
-  TH1F *hEdepos = new TH1F("SPDEnergyDeposit_SPD","Deposited energy distribution (y_{loc}>180 #mum)",150,0.,300.); 
+  TH1F *hEdepos = new TH1F("SPDEnergyDeposit_SPD","SPD Deposited energy distribution (y_{loc}>180 #mum)",150,0.,300.); 
   hEdepos->GetXaxis()->SetTitle("Deposited energy [keV]"); 
   hEdepos->GetYaxis()->SetTitle("# hits");
-  fAliITSQADataMakerSim->Add2HitsList(hEdepos,4+fGenOffsetH);
+  rv = fAliITSQADataMakerSim->Add2HitsList(hEdepos,4+fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()], !expert, image);
   fSPDhHTask++;
 
-  AliDebug(1,Form("%d SPD Hits histograms booked\n",fSPDhHTask));
-
+  AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SPD Hits histograms booked\n",fSPDhHTask));
+  delete [] hmod;
+  return rv ; 
 }
 
 //____________________________________________________________________________
-void AliITSQASPDDataMakerSim::MakeHits(TTree *hits)
+Int_t AliITSQASPDDataMakerSim::MakeHits(TTree *hits)
 { 
   // Fill QA for HITS - SPD -
+  Int_t rv = 0 ; 
   AliITS *fITS  = (AliITS*)gAlice->GetModule("ITS");
   fITS->SetTreeAddress();
   Int_t nmodules;
@@ -313,11 +347,11 @@ void AliITSQASPDDataMakerSim::MakeHits(TTree *hits)
     TObjArray *arrHits = module->GetHits();
     Int_t nhits = arrHits->GetEntriesFast();
     if (imod<80) {
-      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH)->Fill(0.5,nhits);
-      fAliITSQADataMakerSim->GetHitsData(1+fGenOffsetH)->Fill(imod,nhits);
+      fAliITSQADataMakerSim->FillHitsData(fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()],0.5,nhits);
+      fAliITSQADataMakerSim->FillHitsData(1+fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()],imod,nhits);
     } else {
-      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH)->Fill(1,nhits);
-      fAliITSQADataMakerSim->GetHitsData(2+fGenOffsetH)->Fill(imod,nhits);
+      fAliITSQADataMakerSim->FillHitsData(fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()],1,nhits);
+      fAliITSQADataMakerSim->FillHitsData(2+fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()],imod,nhits);
     }
     for (Int_t iHit=0; iHit<nhits; ++iHit) {
       AliITShit *hit = (AliITShit*) arrHits->At(iHit);
@@ -326,29 +360,31 @@ void AliITSQASPDDataMakerSim::MakeHits(TTree *hits)
       hit->GetPositionL(xl,yl,zl,tof);
       hit->GetPositionL0(xl0,yl0,zl0,tof0);
       Float_t dyloc=TMath::Abs(yl-yl0)*10000.;
-      fAliITSQADataMakerSim->GetHitsData(3+fGenOffsetH)->Fill(dyloc);
+      fAliITSQADataMakerSim->FillHitsData(3+fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()],dyloc);
       Float_t edep=hit->GetIonization()*1000000;
       if(dyloc>180.){
-        fAliITSQADataMakerSim->GetHitsData(4+fGenOffsetH)->Fill(edep);
+        fAliITSQADataMakerSim->FillHitsData(4+fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()],edep);
       }
     }
   }
+  //
+  return rv ; 
 }
 
 
 //_______________________________________________________________
 
-Int_t AliITSQASPDDataMakerSim::GetOffset(AliQAv1::TASKINDEX_t task){
+Int_t AliITSQASPDDataMakerSim::GetOffset(AliQAv1::TASKINDEX_t task,Int_t specie){
   // Returns histogram offset according to the specified task
   Int_t offset=0;
   if( task == AliQAv1::kHITS){
-    offset=fGenOffsetH;
+    offset=fGenOffsetH[specie];
   }
   else if( task == AliQAv1::kSDIGITS) {
-    offset=fGenOffsetS;
+    offset=fGenOffsetS[specie];
   }
   else if( task == AliQAv1::kDIGITS) {
-    offset=fGenOffsetD;
+    offset=fGenOffsetD[specie];
   }
   else {
     AliInfo("No task has been selected. TaskHisto set to zero.\n");
@@ -357,6 +393,22 @@ Int_t AliITSQASPDDataMakerSim::GetOffset(AliQAv1::TASKINDEX_t task){
   return offset;
 }
 
+//____________________________________________________________________________ 
+void AliITSQASPDDataMakerSim::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset,Int_t specie ){
+  // Returns histogram offset according to the specified task
+  if( task == AliQAv1::kHITS){
+    fGenOffsetH[specie] = offset;  
+  }
+  else if( task == AliQAv1::kSDIGITS) {
+    fGenOffsetS[specie] = offset;   
+  }
+  else if( task == AliQAv1::kDIGITS) {
+    fGenOffsetD[specie] = offset;   
+  }
+  else {
+    AliInfo("No task has been selected. TaskHisto set to zero.\n");
+  }
+}
 
 //_______________________________________________________________