+ filled=0;
+ empty=0;
+ if(AliITSQADataMakerRec::AreEqual(entries,0.)&& AliITSQADataMakerRec::AreEqual(entries2[0],0.)&& AliITSQADataMakerRec::AreEqual(entries2[1],0.)) break;
+ //else{
+ if(hmodule || (hlayer[0] && hlayer[1])){
+ for(Int_t imod=0;imod<fgknSDDmodules;imod++){
+ Int_t lay=0;
+ Int_t lad=0;
+ Int_t det=0;
+ Int_t module=0;
+ module=imod+fgkmodoffset;
+ AliITSCalibrationSDD * cal=(AliITSCalibrationSDD*)fCalibration->At(imod);
+ if(cal==0) { continue;}
+ AliITSgeomTGeo::GetModuleId(module,lay,lad,det);
+ if (cal->IsBad()){
+ excluded++;
+ excludedmoduleperlayer[lay-3]++;
+ Double_t content=0.;
+ //Double_t contentlayer[2];
+ //for(Int_t i=0;i<2;i++)contentlayer[i]=0.;
+ if(hmodule)content=hmodule->GetBinContent(imod+1);//if expert bit is active the histogram will be stored in the QA file otherwise the histogram will not be written on the logbook
+ // if(hlayer[lay-3]) contentlayer[lay-3]=hlayer[lay-3]->GetBinContent(det,lad);
+ if(AliITSQADataMakerRec::AreEqual(content,0.)== kFALSE) {
+ filledmodules[lay-3]++;
+ filled++;
+ AliError(Form("The module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",module,lay,lad,det));
+ exactive++;
+ exactivemoduleperlayer[lay-3]++;
+ } else if(AliITSQADataMakerRec::AreEqual(content,0.))
+ {
+ emptymodules[lay-3]++; //it has to be empty
+ empty++;
+ }
+ } else {
+ Int_t totside=0;
+ Int_t totactiveside=0;
+ //Int_t totbadside=0;
+ Double_t contentgood=0.;
+
+ for(Int_t i=0;i<2;i++){
+ if(hlayer[lay-3]) contentgood=hlayer[lay-3]->GetBinContent(2*det+i-1,lad);
+ if(cal->IsWingBad(i))
+ {
+ excludeddriftregion++;
+ excludeddrperlayer[lay-3]++;
+ if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kFALSE){
+ AliError(Form("The side %d of the module %d (layer %i, ladder %i det %i ) excluded from the acquisition, took data \n ",i,module,lay,lad,det));
+ exactivedriftregion++;
+ exactivedrperlayer[lay-3]++;
+ filleddr++;
+ filleddriftregion[lay-3]++;
+ }
+ }//end wingbad
+ else{
+ if(AliITSQADataMakerRec::AreEqual(contentgood,0.)==kTRUE)
+ {
+ AliWarning(Form("The side %d of the module %d (layer %i, ladder %i det %i ) is in acquisition, but it didn't take data\n ",i,module, lay, lad, det));
+ }
+ else
+ {
+ totside++;
+ }
+ totactiveside++;
+ }
+ }//end for
+ if(totside==0){
+ AliWarning(Form("The module %d (layer %i, ladder %i det %i ) is in acquisition, but it didn't take data\n ",module, lay, lad, det));
+ emptymodules[lay-3]++;
+ empty++;
+
+ }
+ else
+ if(totside==2){
+ filledmodules[lay-3]++;
+ filled++;
+ }
+ else
+ if(totside==1)
+ {
+ // emptydr++;
+ //emptydriftregion[lay-3]++; //it has to be empty
+ emptydriftregion[lay-3]++;
+ emptydr++;
+ filleddr++;
+ filleddriftregion[lay-3]++;
+ }
+ if(totactiveside==1)
+ {
+ activedriftregion++;
+ activedrperlayer[lay-3]++;
+ }else if(totactiveside==2)
+ {
+ active++;
+ activemoduleperlayer[lay-3]++;
+ }
+
+ }
+ }//end for
+ AliInfo(Form("In total %d modules and %d single drift regions took data.\n ",filled, filleddr));
+ AliInfo(Form("In total %d modules and %d single drift regions were empty\n",empty, emptydr));
+ for(Int_t i=0;i<2;i++)
+ {
+ AliInfo(Form("Layer %i \tempty modules %i \t filled modules %i\n", i+3,emptymodules[i], filledmodules[i]));
+ AliInfo(Form("Layer %i \tempty single drift regions %i \t filled single drift regions %i\n",i+3,emptydriftregion[i], filleddriftregion[i]));
+ }//end else layers
+ emptysum=emptymodules[0]+emptymodules[1];
+ emptydiff=emptysum-excluded;
+ emptyactivemoduleperlayer[0]=emptymodules[0]- excludedmoduleperlayer[0];
+ emptyactivemoduleperlayer[1]=emptymodules[1]- excludedmoduleperlayer[1];
+
+ emptydrsum=emptydriftregion[0]+emptydriftregion[1];
+ emptydrdiff=emptydrsum-excludeddriftregion;
+ emptyactivedrperlayer[0]=emptydriftregion[0]- excludeddrperlayer[0];
+ emptyactivedrperlayer[1]=emptydriftregion[1]- excludeddrperlayer[1];
+
+ Int_t numlimit=1000;
+
+ if(emptysum>excluded||emptydrsum>excludeddriftregion){
+ AliWarning(Form(" %i good module(s) and %i good single drift regions didn't take data! \n",emptydiff,emptydrdiff));
+ AliWarning(Form(" Layer 3: %i good module(s) and %i good single drift regions didn't take data! \n",emptyactivemoduleperlayer[0] ,emptyactivedrperlayer[0] ));
+ AliWarning(Form(" Layer 4: %i good module(s) and %i good single drift regions didn't take data! \n",emptyactivemoduleperlayer[1] ,emptyactivedrperlayer[1] ));
+ //printf("========================= %d",AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::kCosmic));
+ // if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kFALSE){
+ if(AliRecoParam::ConvertIndex(GetEventSpecieForCheck())!=AliRecoParam::kCosmic){
+
+ results1.Form("%i good module(s) and %i good drift regions didn't take data!",emptydiff,emptydrdiff);
+ if(neventsraw<numlimit) {
+ results2.Form(" Events %d .Too few events.DO NOT CALL the Expert ",neventsraw);
+ color=kYellow;
+ textcolor=kBlack;
+ sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+ } else {
+ results2.Form(" Events %d. If PHYSICS, follow the TWiki instruction and call the Expert ",neventsraw);
+ color=kRed;
+ textcolor=kWhite;
+ sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
+ }
+ }
+ else
+ // if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kTRUE)
+ if(AliRecoParam::ConvertIndex(GetEventSpecieForCheck())==AliRecoParam::kCosmic)
+ {
+ numlimit=10000;
+ if(neventsraw<numlimit)
+ {
+ AliWarning(Form("This is a cosmic run. Some module and drift region are empty but all is OK. "));
+ results1.Form("OK. This is a cosmic run. you need a lot of events. Events %i",neventsraw);
+ results2.Form("%i good module(s) and %i good drift are empty! DO NOT CALL THE EXPERT",emptydiff,emptydrdiff);
+ color=kYellow;
+ textcolor=kBlack;
+ sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+ }
+ else
+ {
+ results1.Form("%i good module(s) and %i good drift region(s) have no data!",emptydiff,emptydrdiff);
+ results2.Form(" Cosmic Events %d .Follow the TWiki instruction and call the Expert ",neventsraw);
+ color=kRed;
+ textcolor=kWhite;
+ sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
+ }
+ }
+ }
+
+ if(exactive==0 && emptydiff==0 && exactivedriftregion==0 && emptydrdiff==0){
+ AliInfo(Form("All the active modules (%i) and single drift regions (%i) are in acquisition. The number of excluded modules are %i and the excluded single drift regions are %i\n",active,activedriftregion,excluded,excludeddriftregion));
+ results1.Form("OK.");
+ results2.Form(" All active modules and drift regions in acquisition");
+ color=kGreen;
+ textcolor=kBlack;
+ sddQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
+ }
+ if(exactive!=0||exactivedriftregion!=0){
+ AliError(Form("%i modules and %i single drift regions excluded from the acquisition took data. Active modules%i single drift region %i \n ",exactive,exactivedriftregion,active,activedriftregion));
+ AliError(Form("Layer 3: %i modules and %i single drift regions excluded from the acquisition took data. Active modules%i single drift region %i \n ",exactivemoduleperlayer[0],exactivedrperlayer[0],activemoduleperlayer[0],activedrperlayer[0]));
+ AliError(Form("Layer 3: %i modules and %i single drift regions excluded from the acquisition took data. Active modules%i single drift region %i \n ",exactivemoduleperlayer[1],exactivedrperlayer[1],activemoduleperlayer[1],activedrperlayer[1]));
+ results1.Form("%i modules and %i drift region excluded from the acquisition took data",exactive,exactivedriftregion);
+ results2.Form("Follow the TWiki instructions and Call the SDD expert ");
+ color=kRed;
+ textcolor=kWhite;
+ sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
+ }
+ if(excluded==exactive||excludeddriftregion==exactivedriftregion){
+ AliError(Form("All the modules (%d) or single drift regions (%d) excluded from the acquisition took data!\n Active modules %i \t Active drfift regions %i\n",excluded,excludeddriftregion,active,activedriftregion));
+ results1.Form("All the modules (%d) or drift regions (%d) excluded from the acquisition took data!",excluded,excludeddriftregion );
+ results2.Form("Follow the TWiki instructions and Call the SDD expert ");
+ color=kRed;
+ textcolor=kWhite;
+ sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+ }
+ if(active==0||activedriftregion==0){
+ AliError(Form("No modules or single drift regions took data: excluded %i \t excluded active %i \n\t\t excluded single drift regions %i \t excluded active drift regions %i \n", excluded, exactive, excludeddriftregion, exactivedriftregion));
+ results1.Form("No modules or drift region took data: excluded modules %i excluded drift regions %i ", excluded, excludeddriftregion );
+ results2.Form("Follow the TWiki instructions and Call the SDD expert ");
+ color=kRed;
+ textcolor=kWhite;
+ sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+ }
+
+ //TPaveText *pave[2]={0,0};
+ next.Begin();
+
+ while( (hdata=dynamic_cast<TH1* >(next())) ) {
+ if (hdata){
+ TString hname=hdata->GetName();
+ if(hname.Contains("SDDphizL3") || hname.Contains("SDDphizL4")){
+ if(hname.Contains("NORM"))continue;
+ //AliInfo("========================================Found histo 11\n");
+ TPaveText *ptext = ((TPaveText *)hdata->GetListOfFunctions()->FindObject("TPave"));
+ if(ptext) {
+ ptext->Clear();
+ ptext->AddText(results1.Data());
+ ptext->AddText(results2.Data());
+ ptext->SetFillColor(color);
+ ptext->SetTextColor(textcolor);
+ }
+ } else if(hname.Contains("SDDRawDataCheck")) {
+
+ //AliInfo("========================================Found histo\n");
+ ((TH1F*)hdata)->SetBinContent(5,active);
+ ((TH1F*)hdata)->SetBinContent(6,filled);
+ ((TH1F*)hdata)->SetBinContent(7,activedriftregion);
+ ((TH1F*)hdata)->SetBinContent(8,filleddr);
+ ((TH1F*)hdata)->SetBinContent(9,excluded);
+ ((TH1F*)hdata)->SetBinContent(10,empty);
+ ((TH1F*)hdata)->SetBinContent(11,excludeddriftregion);
+ ((TH1F*)hdata)->SetBinContent(12,emptydr);
+ ((TH1F*)hdata)->SetBinContent(13,exactive);
+ ((TH1F*)hdata)->SetBinContent(14,emptydiff);
+ ((TH1F*)hdata)->SetBinContent(15,exactivedriftregion);
+ ((TH1F*)hdata)->SetBinContent(16,emptydrdiff);
+
+ //layer 3
+ ((TH1F*)hdata)->SetBinContent(19,activemoduleperlayer[0]);
+ ((TH1F*)hdata)->SetBinContent(20,filledmodules[0]);
+ ((TH1F*)hdata)->SetBinContent(21,activedrperlayer[0]);
+ ((TH1F*)hdata)->SetBinContent(22,filleddriftregion[0]);
+ ((TH1F*)hdata)->SetBinContent(23,excludedmoduleperlayer[0]);
+ ((TH1F*)hdata)->SetBinContent(24,emptymodules[0]);
+ ((TH1F*)hdata)->SetBinContent(25,excludeddrperlayer[0]);
+ ((TH1F*)hdata)->SetBinContent(26,emptydriftregion[0]);
+ ((TH1F*)hdata)->SetBinContent(27,exactivemoduleperlayer[0]);
+ ((TH1F*)hdata)->SetBinContent(28,emptyactivemoduleperlayer[0]);
+ ((TH1F*)hdata)->SetBinContent(29,exactivedrperlayer[0]);
+ ((TH1F*)hdata)->SetBinContent(30,emptyactivedrperlayer[0]);
+
+ //layer 4
+ ((TH1F*)hdata)->SetBinContent(33,activemoduleperlayer[1]);
+ ((TH1F*)hdata)->SetBinContent(34,filledmodules[1]);
+ ((TH1F*)hdata)->SetBinContent(35,activedrperlayer[1]);
+ ((TH1F*)hdata)->SetBinContent(36,filleddriftregion[1]);
+ ((TH1F*)hdata)->SetBinContent(37,excludedmoduleperlayer[1]);
+ ((TH1F*)hdata)->SetBinContent(38,emptymodules[1]);
+ ((TH1F*)hdata)->SetBinContent(39,excludeddrperlayer[1]);
+ ((TH1F*)hdata)->SetBinContent(40,emptydriftregion[1]);
+ ((TH1F*)hdata)->SetBinContent(41,exactivemoduleperlayer[1]);
+ ((TH1F*)hdata)->SetBinContent(42,emptyactivemoduleperlayer[1]);
+ ((TH1F*)hdata)->SetBinContent(43,exactivedrperlayer[1]);
+ ((TH1F*)hdata)->SetBinContent(44,emptyactivedrperlayer[1]);
+ //break;
+ }
+ }//if hdata
+
+ }//end while
+
+ }//end else
+ delete hmodule;
+ hmodule=NULL;
+ for(Int_t i=0;i<2;i++) {
+ delete hlayer[i];
+ hlayer[i]=NULL;
+ }//end for
+
+ }//end raw
+
+ break;
+
+ case AliQAv1::kNULLTASK:{
+ AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index)));
+ sddQACheckerValue=1.;
+ }
+ break;
+
+ case AliQAv1::kREC:
+ {
+ Int_t uidrec=list->GetUniqueID();
+ AliInfo(Form("Check on %s\n",AliQAv1::GetAliTaskName(index)));
+ if(uidrec==20){
+ //recpoints
+ if (list->GetEntries() == 0){ //check if the list is empty
+ //printf("sddQACheckerValue = %f \t value %f\n",sddQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]);
+ sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+ //break;
+ }//end if getentries
+
+
+ TH1 *hmodule=NULL;
+ TH2 *hlayer[2];
+ hdata=NULL;
+ for(Int_t i=0;i<2;i++)hlayer[i]=NULL;
+
+ //check counters
+ Int_t emptymodules[2], filledmodules[2],emptyladders[2],filledladders[2],emptydriftregion[2], filleddriftregion[2], excludedmoduleperlayer[2], excludeddrperlayer[2], activemoduleperlayer[2],activedrperlayer[2],exactivemoduleperlayer[2],exactivedrperlayer[2];
+ Int_t excluded=0; //excluded modules
+ Int_t excludeddriftregion=0; //excluded single drift region
+ Int_t active=0; //active modules
+ Int_t activedriftregion=0; //active single drift region
+ Int_t exactive=0; //excluded modules but taking data
+ Int_t exactivedriftregion=0; //excluded single drift region but taking data
+ Int_t empty=0;
+ Int_t filled=0;
+ Int_t emptydr=0;
+ Int_t filleddr=0;
+ //Int_t emptyactivemodule=0;
+ Int_t emptyactivemoduleperlayer[2];
+ //Int_t emptydractivemodule=0;
+ Int_t emptyactivedrperlayer[2];
+ Int_t emptysum=0;
+ Int_t emptydiff=0;
+ Int_t emptydrsum=0;
+ Int_t emptydrdiff=0;
+
+ for(Int_t i=0;i<2;i++)
+ {
+ emptymodules[i]=0;
+ filledmodules[i]=0;
+ emptyladders[i]=0;
+ filledladders[i]=0;
+ emptydriftregion[i]=0;
+ filleddriftregion[i]=0;
+ excludedmoduleperlayer[i]=0;
+ excludeddrperlayer[i]=0;
+ activemoduleperlayer[i]=0;
+ activedrperlayer[i]=0;
+ exactivemoduleperlayer[i]=0;
+ exactivedrperlayer[i]=0;
+ emptyactivemoduleperlayer[i]=0;
+ emptyactivedrperlayer[i]=0;
+ }
+
+ Int_t neventsrecpoints=0;
+
+ while( (hdata = dynamic_cast<TH1* >(next())) ){
+ if (hdata){
+ TString hname=hdata->GetName();
+
+ if(hname.Contains("SDDRecPointCheck"))
+ {
+ neventsrecpoints=(Int_t)hdata->GetBinContent(1);
+ //break;
+ }
+ else{continue;}
+ }//end if hdata
+ }//end while
+
+ next.Begin();
+
+ while((hdata=dynamic_cast<TH1* >(next()))){