Changing once more (hopefully we get it correct this time...) the logic to trig the...
[u/mrichter/AliRoot.git] / ITS / AliITSQASSDDataMakerSim.cxx
index 4080a1b..fa41871 100644 (file)
@@ -59,7 +59,16 @@ fGenOffsetH(0),
 fGenOffsetS(0), 
 fGenOffsetD(0) 
 {
-  //ctor used to discriminate OnLine-Offline analysis   
+  //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;
+    }  
 }
 
 //____________________________________________________________________________ 
@@ -114,13 +123,13 @@ Int_t AliITSQASSDDataMakerSim::InitDigits() {
                                  "SSD Digits Module;SSD Module Number;N_{DIGITS}",
                                  1698,499.5,2197.5);  
   rv = fAliITSQADataMakerSim->Add2DigitsList(fHistSSDModule,
-                                       fGenOffsetD + 0, !expert, image);
+                                       fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()] + 0, !expert, image);
   fSSDhDTask += 1;
   TH2F *fHistSSDModuleStrip = new TH2F("fHistSSDDigitsModuleStrip",
                                       "SSD Digits Module Strip;N_{Strip};N_{Module}",
                                       1540,0,1540,1698,499.5,2197.5);  
   rv = fAliITSQADataMakerSim->Add2DigitsList(fHistSSDModuleStrip,
-                                       fGenOffsetD + 1, !expert, image);
+                                       fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()] + 1, !expert, image);
   fSSDhDTask += 1;
 
   AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SSD Digits histograms booked\n",fSSDhDTask));
@@ -131,10 +140,7 @@ Int_t AliITSQASSDDataMakerSim::InitDigits() {
 Int_t AliITSQASSDDataMakerSim::MakeDigits(TTree *digits) { 
   // Fill QA for DIGIT - SSD -
   Int_t rv = 0 ; 
-  // Check id histograms already created for this Event Specie
-  if ( ! fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD) )
-    rv = InitDigits() ;
+
   AliITS *fITS  = (AliITS*)gAlice->GetModule("ITS");
   fITS->SetTreeAddress();
   TClonesArray *iSSDdigits  = fITS->DigitsAddress(2);
@@ -142,14 +148,14 @@ Int_t AliITSQASSDDataMakerSim::MakeDigits(TTree *digits) {
     iSSDdigits->Clear();
     digits->GetEvent(iModule);    
     Int_t ndigits = iSSDdigits->GetEntries();
-    fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD + 0)->Fill(iModule,ndigits);
+    fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()] + 0)->Fill(iModule,ndigits);
     if(ndigits != 0)
       AliDebug(AliQAv1::GetQADebugLevel(),Form("Module: %d - Digits: %d",iModule,ndigits));
  
     for (Int_t iDigit = 0; iDigit < ndigits; iDigit++) {
       AliITSdigit *dig = (AliITSdigit*)iSSDdigits->UncheckedAt(iDigit);
       Int_t fStripNumber = (dig->GetCoord1() == 0) ? dig->GetCoord2() : dig->GetCoord2() + fgkNumberOfPSideStrips;
-      ((TH2F *)fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD + 1))->Fill(fStripNumber,iModule,dig->GetSignal());
+      ((TH2F *)fAliITSQADataMakerSim->GetDigitsData(fGenOffsetD[fAliITSQADataMakerSim->GetEventSpecie()] + 1))->Fill(fStripNumber,iModule,dig->GetSignal());
     }//digit loop
   }//module loop
   return rv ; 
@@ -168,7 +174,7 @@ Int_t AliITSQASSDDataMakerSim::InitSDigits() {
                                  "SSD SDigits Module;SSD Module Number;N_{SDIGITS}",
                                  1698,499.5,2197.5);  
   rv = fAliITSQADataMakerSim->Add2SDigitsList(fHistSSDModule,
-                                        fGenOffsetS + 0, !expert, image);
+                                        fGenOffsetS[fAliITSQADataMakerSim->GetEventSpecie()] + 0, !expert, image);
   fSSDhSTask += 1;  
 
   AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SSD SDigits histograms booked\n",fSSDhSTask));
@@ -179,9 +185,6 @@ Int_t AliITSQASSDDataMakerSim::InitSDigits() {
 Int_t AliITSQASSDDataMakerSim::MakeSDigits(TTree *sdigits) { 
   // Fill QA for SDIGIT - SSD -
   Int_t rv = 0 ; 
-  // Check id histograms already created for this Event Specie
-  if ( ! fAliITSQADataMakerSim->GetSDigitsData(fGenOffsetS) )
-    rv = InitSDigits() ;
  
   static TClonesArray iSSDEmpty("AliITSpListItem",10000);
   iSSDEmpty.Clear();
@@ -195,7 +198,7 @@ Int_t AliITSQASSDDataMakerSim::MakeSDigits(TTree *sdigits) {
     iSSDsdigits->Clear();
     sdigits->GetEvent(iModule);    
     Int_t ndigits = iSSDsdigits->GetEntries();
-    fAliITSQADataMakerSim->GetSDigitsData(fGenOffsetS + 0)->Fill(iModule,ndigits);
+    fAliITSQADataMakerSim->GetSDigitsData(fGenOffsetS[fAliITSQADataMakerSim->GetEventSpecie()] + 0)->Fill(iModule,ndigits);
     if(ndigits != 0)
       AliDebug(AliQAv1::GetQADebugLevel(),Form("Module: %d - Digits: %d",iModule,ndigits));
 
@@ -218,59 +221,59 @@ Int_t AliITSQASSDDataMakerSim::InitHits() {
 
   // custom code here
   TH1F *fHistSSDModule = new TH1F("fHistSSDHitsModule",
-                                 "SSD Hits Module;SDD Module Number;N_{HITS}",
+                                 "SSD Hits Module;SSD Module Number;N_{HITS}",
                                  1698,499.5,2197.5); 
   rv = fAliITSQADataMakerSim->Add2HitsList(fHistSSDModule,
-                                     fGenOffsetH + 0, !expert, image);
+                                     fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 0, !expert, image);
   fSSDhHTask += 1;
   TH1F *fHistSSDGlobalX = new TH1F("fHistSSDHitsGlobalX",
                                   "SSD Hits Global X;x [cm];Entries",
                                   1000,-50.,50.);
   rv = fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalX,
-                                     fGenOffsetH + 1, !expert, image);
+                                     fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 1, !expert, image);
   fSSDhHTask += 1;
   TH1F *fHistSSDGlobalY = new TH1F("fHistSSDHitsGlobalY",
                                   "SSD Hits Global Y;y [cm];Entries",
                                   1000,-50.,50.);
   rv = fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalY,
-                                     fGenOffsetH + 2, !expert, image);
+                                     fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 2, !expert, image);
   fSSDhHTask += 1;
   TH1F *fHistSSDGlobalZ = new TH1F("fHistSSDHitsGlobalZ",
                                   "SSD Hits Global Z ;z [cm];Entries",
                                   1000,-60.,60.);
   rv = fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalZ,
-                                     fGenOffsetH + 3, !expert, image);
+                                     fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 3, !expert, image);
   fSSDhHTask += 1;
   TH1F *fHistSSDLocalX = new TH1F("fHistSSDHitsLocalX",
                                  "SSD Hits Local X;x [cm];Entries",
                                  1000,-4.,4.);
   rv = fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalX,
-                                     fGenOffsetH + 4, !expert, image);
+                                     fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 4, !expert, image);
   fSSDhHTask += 1;
   TH1F *fHistSSDLocalY = new TH1F("fHistSSDHitsLocalY",
                                  "SSD Hits Local Y;y [cm];Entries",
                                  1000,-0.1,0.1);
   rv = fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalY,
-                                     fGenOffsetH + 5, !expert, image);
+                                     fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 5, !expert, image);
   fSSDhHTask += 1;
   TH1F *fHistSSDLocalZ = new TH1F("fHistSSDHitsLocalZ",
                                  "SSD Hits Local Z;z [cm];Entries",
                                  1000,-4.,4.);
   rv = fAliITSQADataMakerSim->Add2HitsList(fHistSSDLocalZ,
-                                     fGenOffsetH + 6, !expert, image);
+                                     fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 6, !expert, image);
   fSSDhHTask += 1;
   TH1F *fHistSSDIonization = new TH1F("fHistSSDHitsIonization",
                                      "SSD Hits Ionization;log(dE/dx) [KeV];N_{Hits}",
                                      100,-7,-2);
   rv = fAliITSQADataMakerSim->Add2HitsList(fHistSSDIonization,
-                                     fGenOffsetH + 7, !expert, image);
+                                     fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 7, !expert, image);
   fSSDhHTask += 1;
   TH2F *fHistSSDGlobalXY = new TH2F("fHistSSDHitsGlobalXY",
                                    "SSD Hits Global XY;x [cm];y [cm]",
                                    1000,-50.,50.,
                                    1000,-50.,50.);
   rv = fAliITSQADataMakerSim->Add2HitsList(fHistSSDGlobalXY,
-                                     fGenOffsetH + 8, !expert, image);
+                                     fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 8, !expert, image);
   fSSDhHTask += 1;
  
   AliDebug(AliQAv1::GetQADebugLevel(),Form("%d SSD Hits histograms booked\n",fSSDhHTask));
@@ -282,9 +285,6 @@ Int_t AliITSQASSDDataMakerSim::InitHits() {
 Int_t AliITSQASSDDataMakerSim::MakeHits(TTree *hits) { 
   // Fill QA for HITS - SSD -
   Int_t rv = 0 ; 
-  // Check id histograms already created for this Event Specie
-  if ( ! fAliITSQADataMakerSim->GetHitsData(fGenOffsetH) )
-    rv = InitHits() ;
  
   AliITS *fITS  = (AliITS*)gAlice->GetModule("ITS");
   fITS->SetTreeAddress();
@@ -300,33 +300,33 @@ Int_t AliITSQASSDDataMakerSim::MakeHits(TTree *hits) {
     for (Int_t iHit = 0; iHit < nhits; iHit++) {
       AliITShit *hit = (AliITShit*) arrHits->At(iHit);
       
-      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 0)->Fill(iModule);
-      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 1)->Fill(hit->GetXG());
-      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 2)->Fill(hit->GetYG());
-      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 3)->Fill(hit->GetZG());
-      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 4)->Fill(hit->GetXL());
-      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 5)->Fill(hit->GetYL());
-      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 6)->Fill(hit->GetZL());
+      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 0)->Fill(iModule);
+      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 1)->Fill(hit->GetXG());
+      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 2)->Fill(hit->GetYG());
+      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 3)->Fill(hit->GetZG());
+      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 4)->Fill(hit->GetXL());
+      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 5)->Fill(hit->GetYL());
+      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 6)->Fill(hit->GetZL());
       if(hit->GetIonization())
-       fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 7)->Fill(TMath::Log10(hit->GetIonization()));
-      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH + 8)->Fill(hit->GetXG(),hit->GetYG());
+       fAliITSQADataMakerSim->GetHitsData(fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 7)->Fill(TMath::Log10(hit->GetIonization()));
+      fAliITSQADataMakerSim->GetHitsData(fGenOffsetH[fAliITSQADataMakerSim->GetEventSpecie()] + 8)->Fill(hit->GetXG(),hit->GetYG());
     }//hit loop
   }//module loop  
   return rv ; 
 }
 
 //____________________________________________________________________________ 
-Int_t AliITSQASSDDataMakerSim::GetOffset(AliQAv1::TASKINDEX_t task){
+Int_t AliITSQASSDDataMakerSim::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");
@@ -337,16 +337,16 @@ Int_t AliITSQASSDDataMakerSim::GetOffset(AliQAv1::TASKINDEX_t task){
 
 
 //____________________________________________________________________________ 
-void AliITSQASSDDataMakerSim::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset){
+void AliITSQASSDDataMakerSim::SetOffset(AliQAv1::TASKINDEX_t task, Int_t offset,Int_t specie ){
   // Returns histogram offset according to the specified task
   if( task == AliQAv1::kHITS){
-    fGenOffsetH = offset;  
+    fGenOffsetH[specie] = offset;  
   }
   else if( task == AliQAv1::kSDIGITS) {
-    fGenOffsetS = offset;   
+    fGenOffsetS[specie] = offset;   
   }
   else if( task == AliQAv1::kDIGITS) {
-    fGenOffsetD = offset;   
+    fGenOffsetD[specie] = offset;   
   }
   else {
     AliInfo("No task has been selected. TaskHisto set to zero.\n");