Updates in SDD QA checker and macros (M. Siciliano)
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 13 Jun 2011 14:11:28 +0000 (14:11 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 13 Jun 2011 14:11:28 +0000 (14:11 +0000)
ITS/AliITSQASDDChecker.cxx
ITS/macrosSDD/ITSQArecoparam.C
ITS/macrosSDD/TrendQASDD.C

index 4c0bcea..ce01fb4 100644 (file)
@@ -92,7 +92,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
 
   AliDebug(1,Form("AliITSQASDDChecker called with offset: %d\n", fSubDetOffset));
 
-  Double_t SDDQACheckerValue = 0.;
+  Double_t sddQACheckerValue = 0.;
   TH1 *hdata=NULL;
   Double_t entries=0.;
   Double_t entries2[2];
@@ -105,7 +105,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
       {
        AliError("Calibration object retrieval failed! SDD will not be processed");
        fCalibration = NULL;
-       SDDQACheckerValue= fHighSDDValue[AliQAv1::kWARNING];
+       sddQACheckerValue= fHighSDDValue[AliQAv1::kWARNING];
       }
     else{
       fCalibration = (TObjArray *)calibSDD->GetObject();
@@ -132,7 +132,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
 //       if(fRawModulePattern) { delete fRawModulePattern; fRawModulePattern = 0; }
 //       if(fRawL3Pattern) { delete fRawL3Pattern; fRawL3Pattern = 0; }
 //       if(fRawL4Pattern) { delete fRawL4Pattern; fRawL4Pattern = 0; }
-      if (list->GetEntries() == 0){AliError("Raw List for SDD is empty \n");SDDQACheckerValue += fHighSDDValue[AliQAv1::kFATAL];       break;}
+      if (list->GetEntries() == 0){AliError("Raw List for SDD is empty \n");sddQACheckerValue += fHighSDDValue[AliQAv1::kFATAL];       break;}
       TH1 *hmodule=NULL;
       TH2 *hlayer[2]; 
       hdata=NULL;
@@ -205,7 +205,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
            if(hname.Contains("NORM")) continue;
            hmodule=(TH1*)hdata->Clone();
            entries= hdata->GetEntries();
-           if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
+           if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
            else{
              int modmax=hdata->GetNbinsX();
              Double_t content=0;
@@ -244,7 +244,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
            if(hdata->GetEntries()>0.)fractionAboveThreshold=((Float_t) aboveThreshold)/hdata->GetEntries();
            if(hname.Contains("L3")) AliInfo(Form("SDD check number 1, L3: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
            if(hname.Contains("L4")) AliInfo(Form("SDD check number 2, L4: Raw fractionAboveThreshold: %f",fractionAboveThreshold));
-           if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+           if(fractionAboveThreshold > fThresholdForRelativeOccupancy) {sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
              if(hname.Contains("L3")) AliInfo(Form("SDD check number 1: Set Warning (L3 Raw)"));
              if(hname.Contains("L4")) AliInfo(Form("SDD check number 2: Set Warning (L4 Raw)")); } }//relativeoccupancy
 
@@ -254,7 +254,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
            else  if(hname.Contains("4"))layer=1;
            entries2[layer]=hdata->GetEntries();
            if(entries2[layer]==0){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));
-             SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
+             sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
            else{
              Int_t layer1=0;
              if(hname.Contains("3"))layer1=0;
@@ -399,34 +399,57 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
        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! Check the calibration\n",emptydiff,emptydrdiff));
-         AliWarning(Form(" Layer 3: %i good module(s) and %i good single drift regions didn't take data! Check the calibration\n",emptyactivemoduleperlayer[0] ,emptyactivedrperlayer[0] ));
-         AliWarning(Form(" Layer 4: %i good module(s) and %i good single drift regions didn't take data! Check the calibration\n",emptyactivemoduleperlayer[1] ,emptyactivedrperlayer[1] ));
-         
-         
-         results1.Form("%i good module(s) and %i good drift regions didn't take data!",emptydiff,emptydrdiff);
-         if(neventsraw<500)
-           {
-             results2.Form(" Events %d .Too few events.DO NOT CALL the Expert ",neventsraw);
-             color=5;
-             SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
-           }
+       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){     
+           
+           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=5;
+               sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+             }
+           else
+             {
+               results2.Form(" Events %d .Follow the TWiki instruction and call the Expert ",neventsraw);
+               color=2;
+               sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
+             }
+         }
          else
-           {
-             results2.Form(" Events %d .Follow the TWiki instruction and call the Expert ",neventsraw);
-             color=2;
-             SDDQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
-           }
+           if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kTRUE)
+             {
+               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. Thi is a cosmic run. you need a lot of events");
+                   results2.Form("%i good module(s) and %i good drift are empty! DO NOT CALL THE EXPERT",emptydiff,emptydrdiff);
+                   color=5;
+                   sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+                 }
+               else
+                 {
+                   results1.Form("%i good module(s) and %i good drift region(s) have not recpoints!",emptydiff,emptydrdiff);
+                   results2.Form(" Events %d .Follow the TWiki instruction and call the Expert ",neventsraw);
+                   color=2;
+                   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=3;
-         SDDQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
+         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));
@@ -435,21 +458,21 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
          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=2;      
-         SDDQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
+         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=6;
-         SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+         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=6;
-         SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+         sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
        }
 
        TPaveText *pave[2];
@@ -538,7 +561,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
       
   case AliQAv1::kNULLTASK:{
     AliInfo(Form("No Check on %s\n",AliQAv1::GetAliTaskName(index))); 
-    SDDQACheckerValue=1.;
+    sddQACheckerValue=1.;
   }
     break;
     
@@ -549,8 +572,8 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
       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]; 
+         //printf("sddQACheckerValue = %f \t value %f\n",sddQACheckerValue,fHighSDDValue[AliQAv1::kFATAL]);
+         sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL]; 
          //break;                      
        }//end if getentries
       
@@ -632,7 +655,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
              if(hname.Contains("L3")) AliInfo(Form("SDD check number 3, L3: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
              if(hname.Contains("L4")) AliInfo(Form("SDD check number 4, L4: RecPoints fractionAboveThreshold: %f",fractionAboveThreshold));
              if(fractionAboveThreshold > fThresholdForRelativeOccupancy) { 
-               SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+               sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
                if(hname.Contains("L3")) AliInfo(Form("SDD check number 3: Set Warning (L3 RecPoints)"));
                if(hname.Contains("L4")) AliInfo(Form("SDD check number 4: Set Warning (L4 RecPoints)"));
              }
@@ -652,7 +675,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
              if(hname.Contains("L3")) AliInfo(Form("SDD check number 5, L3: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
              if(hname.Contains("L4")) AliInfo(Form("SDD check number 6, L4: RecPoints2Raws fractionBelowThreshold: %f",fractionBelowThreshold));
              if(fractionBelowThreshold > fThresholdForRelativeOccupancy) { 
-               SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+               sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
                if(hname.Contains("L3")) AliInfo(Form("SDD check number 5: Set Warning (L3 RecPoints2Raws)"));
                if(hname.Contains("L4")) AliInfo(Form("SDD check number 6: Set Warning (L4 RecPoints2Raws)"));
              }
@@ -665,7 +688,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
            if(hname.Contains("NORM")) continue;
            hmodule=(TH1*)hdata->Clone();
            entries= hdata->GetEntries();
-           if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
+           if(AliITSQADataMakerRec::AreEqual(entries,0.)){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//endif entries
            else{
              int modmax=hdata->GetNbinsX();
              Double_t content=0;
@@ -700,7 +723,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
            else  if(hname.Contains("4"))layer=1;
            entries2[layer]=hdata->GetEntries();
            if(entries2[layer]==0){AliWarning(Form("===================>>>>>> No entries in  %s \n",hname.Data()));
-             SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
+             sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];}//end if getentries
            else{
              Int_t layer1=0;
              if(hname.Contains("3"))layer1=0;
@@ -845,27 +868,51 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
        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 have not recpoints! Check the calibration\n",emptydiff,emptydrdiff));
-         AliWarning(Form(" Layer 3: %i good module(s) and %i good single drift regions have not recpoints! Check the calibration\n",emptyactivemoduleperlayer[0] ,emptyactivedrperlayer[0] ));
-         AliWarning(Form(" Layer 4: %i good module(s) and %i good single drift regions have not recpoints! Check the calibration\n",emptyactivemoduleperlayer[1] ,emptyactivedrperlayer[1] ));
-         
-         //SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+         AliWarning(Form(" %i good module(s) and %i good single drift regions have not recpoints! \n",emptydiff,emptydrdiff));
+         AliWarning(Form(" Layer 3: %i good module(s) and %i good single drift regions have not recpoints! \n",emptyactivemoduleperlayer[0] ,emptyactivedrperlayer[0] ));
+         AliWarning(Form(" Layer 4: %i good module(s) and %i good single drift regions have not recpoints! \n",emptyactivemoduleperlayer[1] ,emptyactivedrperlayer[1] ));
          
+         //sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+         Int_t numlimits=1000;   
+
          results1.Form("%i good module(s) and %i good drift region(s) have not recpoints!",emptydiff,emptydrdiff);
-         if(neventsrecpoints<500)
+         if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kFALSE)
            {
-             results2.Form(" Events %d .Too few events.DO NOT CALL the Expert ",neventsrecpoints);
-             color=5;
-             SDDQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+             if(neventsrecpoints<numlimits)
+               {
+                 results2.Form(" Events %d .Too few events.DO NOT CALL the Expert ",neventsrecpoints);
+                 color=5;
+                 sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+               }
+             else
+               {
+                 results2.Form(" Events %d .Follow the TWiki instruction and call the Expert ",neventsrecpoints);
+                 color=2;
+                 sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
+               }
            }
          else
-           {
-             results2.Form(" Events %d .Follow the TWiki instruction and call the Expert ",neventsrecpoints);
-             color=2;
-             SDDQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
-           }
+           if((AliQAv1::Instance(AliQAv1::GetDetIndex("ITS")))->IsEventSpecieSet(AliRecoParam::kCosmic)==kTRUE)
+             {
+               numlimit=10000;
+               if(neventsrecpoints<numlimit)
+                 {
+                   AliWarning(Form("This is a cosmic run. Some module and drift region are empty but all is OK. "));
+                   results1.Form("OK. Thi is a cosmic run. You need a lot of events");
+                   results2.Form("%i good module(s) and %i good drift are empty! DO NOT CALL THE EXPERT",emptydiff,emptydrdiff);
+                   color=5;
+                   sddQACheckerValue=fHighSDDValue[AliQAv1::kWARNING];
+                 }
+               else
+                 {
+                   results1.Form("%i good module(s) and %i good drift region(s) have not recpoints!",emptydiff,emptydrdiff);
+                   results2.Form(" Events %d .Follow the TWiki instruction and call the Expert ",neventsrecpoints);
+                   color=2;
+                   sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
+                 }
+             }
        }
        
       
@@ -875,7 +922,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
          results1.Form("OK.");
          results2.Form(" All active modules have recpoints");
          color=3;
-         SDDQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
+         sddQACheckerValue=fHighSDDValue[AliQAv1::kINFO];
        }
        if(exactive!=0||exactivedriftregion!=0){
          AliError(Form("%i modules and %i single  drift regions excluded from the acquisition have recpoints. Active modules %i single drift region %i \n ",exactive,exactivedriftregion,active,activedriftregion));
@@ -884,21 +931,21 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
          results1.Form("%i modules and %i drift region excluded from the acquisition have recpoints",exactive,exactivedriftregion);
          results2.Form("Follow the TWiki instructions and Call the SDD expert ");
          color=2;      
-         SDDQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
+         sddQACheckerValue=fHighSDDValue[AliQAv1::kERROR];
        }
        if(excluded==exactive||excludeddriftregion==exactivedriftregion){
          AliError(Form("All the modules (%d) or single drift regions (%d) excluded from the acquisition have recpoints!\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 have recpoints!",excluded,excludeddriftregion );
          results2.Form("Follow the TWiki instructions and Call the SDD expert ");
          color=6;
-         SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+         sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
        }
        if(active==0||activedriftregion==0){
          AliError(Form("No modules or single drift regions have recpoints: 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 have recpoints: excluded modules %i  excluded drift regions %i ", excluded, excludeddriftregion );
          results2.Form("Follow the TWiki instructions and Call the SDD expert ");
          color=6;
-         SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+         sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
        }
 
        TPaveText *pave[2];
@@ -982,39 +1029,39 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
       }//end for      
 
 
-      //SDDQACheckerValue=1.;
+      //sddQACheckerValue=1.;
       }//end recpoint list uid = 20
       else if(uidrec==40)
        {
          //digitsr
          if (list->GetEntries() == 0){ 
-           SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+           sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
            break;
          } else{
        
            while( (hdata = dynamic_cast<TH1* >(next())) ){
              if (hdata){
-               if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
+               if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
                else {
                  TString hname=hdata->GetName();
                  if(hname.Contains("SDD DIGITS Module Pattern")) {
                    //see raws
                
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                  } else if(hname.Contains("SDD Anode Distribution")) {
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                  } else if(hname.Contains("SDD Tbin Distribution")) {
                    //to do as rp
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                  } else if(hname.Contains("SDD ADC Counts Distribution")) {
-                   SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                   sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                  }//end adc counts
              
                }//end entries !=0
              }//end hdata
            }//end while
          }//end else
-         SDDQACheckerValue=1.;
+         sddQACheckerValue=1.;
        }
 
     }
@@ -1022,18 +1069,18 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
   case AliQAv1::kANA:
     {
       AliInfo(Form("===================> No Check on %s\n",AliQAv1::GetAliTaskName(index)));
-      SDDQACheckerValue=1.; 
+      sddQACheckerValue=1.; 
     }
     break;
   case AliQAv1::kESD:
     {
       AliInfo(Form("==================>  No Check on %s\n",AliQAv1::GetAliTaskName(index)));
-      SDDQACheckerValue=1.;
+      sddQACheckerValue=1.;
     } 
     break;
   case AliQAv1::kNTASK:{
     AliInfo(Form("==================>  No Check on %s\n",AliQAv1::GetAliTaskName(index))); 
-    SDDQACheckerValue=1.;
+    sddQACheckerValue=1.;
   }
     break;
   case AliQAv1::kSIM:{
@@ -1042,26 +1089,26 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
     if(uid==60) {
       //digits
       if (list->GetEntries() == 0){ 
-       SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+       sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
        break;
       } else{
        
        while( (hdata = dynamic_cast<TH1* >(next())) ){
          if (hdata){
-           if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
+           if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
            else {
              TString hname=hdata->GetName();
              if(hname.Contains("SDDDIGITSModulePattern")) {
                //see raws
                
-               SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+               sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
              } else if(hname.Contains("SDDAnodeDistribution")) {
-               SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+               sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
              } else if(hname.Contains("SDDTbinDistribution")) {
                //to do as rp
-               SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+               sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
              } else if(hname.Contains("SDDADCCountsDistribution")) {
-               SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+               sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
              }//end adc counts
              
            }//end entries !=0
@@ -1072,25 +1119,25 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
       {
        //hits
        if (list->GetEntries() == 0){ 
-         SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+         sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
          break;
        } 
        else{
          
          while( (hdata = dynamic_cast<TH1* >(next())) ){
            if (hdata){
-             if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
+             if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
              else {
                TString hname=hdata->GetName();
                if(hname.Contains("SDDHITSModulePattern")) {
                  //to do as raws
-                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                } else if(hname.Contains("SDDHITlenghtalonglocalYCoord")) {
-                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                } else if(hname.Contains("SDDHITlenghtalonglocalYCoordZoom")) {
-                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                } else if(hname.Contains("SDDDepositedEnergyDistribution")) {
-                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                }//end deposited energy
                
              }//end entries !=0
@@ -1101,32 +1148,32 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
       {
        //sdigits
        if (list->GetEntries() == 0){ 
-         SDDQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
+         sddQACheckerValue=fHighSDDValue[AliQAv1::kFATAL];
          break;
        } else{
          
          while( (hdata = dynamic_cast<TH1* >(next())) ){
            if (hdata){
-             if(hdata->GetEntries()==0)SDDQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
+             if(hdata->GetEntries()==0)sddQACheckerValue += fStepBitSDD[AliQAv1::kFATAL];
              else {
                TString hname=hdata->GetName();
                if(hname.Contains("SDDSDIGITSModulePattern")) {
                  //to do as raws
-                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                } else if(hname.Contains("SDDAnodeDistribution")) {
-                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                } else if(hname.Contains("SDDTbinDistribution")) {
                  //to do as rp
-                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                } else if(hname.Contains("SDDADCCountsDistribution")) {
-                 SDDQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
+                 sddQACheckerValue += fStepBitSDD[AliQAv1::kINFO];    
                }//end adc counts bindistribution
              }//end entries !=0
            }//end hdata
          }//end while
        }//end else
       }//end sdigits
-    SDDQACheckerValue=1.;
+    sddQACheckerValue=1.;
   }
     break;
     
@@ -1136,7 +1183,7 @@ Double_t AliITSQASDDChecker::Check(AliQAv1::ALITASK_t index, const TObjArray * l
   if(hdata) delete hdata;
 
 
-  return SDDQACheckerValue;    
+  return sddQACheckerValue;    
 }
 
 //__________________________________________________________________
@@ -1175,9 +1222,11 @@ void  AliITSQASDDChecker::SetSDDLimits(const Float_t *lowvalue, const Float_t *
 //__________________________________________________________________
 Bool_t  AliITSQASDDChecker::MakeSDDImage( TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode)
 {
+  //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used
+  //
   Bool_t rval=kFALSE;
   fImage=(TCanvas**)AliQAChecker::Instance()->GetDetQAChecker(0)->GetImage();
-  //create the image for raws and recpoints. In the other case, the default methodof CheckerBase class will be used
+
   switch(task)
     {
     case AliQAv1::kRAWS:{
@@ -1203,6 +1252,7 @@ return rval;
 //_______________________________________________________________________
 Bool_t AliITSQASDDChecker::MakeSDDRawsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
 {
+  // MakeSDDRawsImage: raw data QA plots
 
     for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
       //printf("-------------------------> %i \n", esIndex);
@@ -1272,6 +1322,7 @@ Bool_t AliITSQASDDChecker::MakeSDDRawsImage(TObjArray ** list, AliQAv1::TASKINDE
 //_______________________________________________________________________
 Bool_t AliITSQASDDChecker::MakeSDDRecPointsImage(TObjArray ** list, AliQAv1::TASKINDEX_t task, AliQAv1::MODE_t mode )
 {
+  // MakeSDDRecPointsImage: rec point QA plots
 
     for (Int_t esIndex = 0 ; esIndex < AliRecoParam::kNSpecies ; esIndex++) {
       if (! AliQAv1::Instance(AliQAv1::GetDetIndex(GetName()))->IsEventSpecieSet(AliRecoParam::ConvertIndex(esIndex)) || list[esIndex]->GetEntries() == 0) 
index 23e86e5..8b79f34 100644 (file)
@@ -42,7 +42,7 @@
 #include "AliGRPObject.h"
 #include "AliRunInfo.h"
 #endif
-void ITSQArecoparam(char *iFile,Int_t idet=2,Int_t FirstEvt=0, Int_t MaxEvts=1000000)
+void ITSQArecoparam(char *iFile, Int_t runNb=150000, Int_t idet=2, Int_t FirstEvt=0, Int_t MaxEvts=1000000)
 {
   TString namefile(iFile);
   if(namefile.Contains("alien"))
@@ -58,8 +58,8 @@ void ITSQArecoparam(char *iFile,Int_t idet=2,Int_t FirstEvt=0, Int_t MaxEvts=100
   AliRawReader *rd=NULL; 
   if(strstr(iFile,".root")!=0){rd = new AliRawReaderRoot(iFile,FirstEvt);}
   else{rd=new AliRawReaderDate(iFile,FirstEvt);}
-  Int_t runNumber = rd->GetRunNumber();
-  cout << "ITS Quality Assurance Prototype" << endl; 
+  //Int_t runNumber = rd->GetRunNumber();
+  cout << "ITS Quality Assurance Prototype for run "<< runNb << endl; 
   //TStopwatch mytimer;
   //TString namefile(iFile);
   // Set OCDB if needed
@@ -70,7 +70,7 @@ void ITSQArecoparam(char *iFile,Int_t idet=2,Int_t FirstEvt=0, Int_t MaxEvts=100
       man->SetDefaultStorage("alien://folder=/alice/data/2011/OCDB");
       //}
       //else{man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");}
-    man->SetRun(runNumber);
+    man->SetRun(runNb);
     AliQAv1::SetQARefStorage("local://$ALICE_ROOT/QARef") ;
   }
   AliCDBManager::Instance()->GetAll(Form("ITS/Calib/*"));
@@ -197,7 +197,7 @@ void ITSQArecoparam(char *iFile,Int_t idet=2,Int_t FirstEvt=0, Int_t MaxEvts=100
 
   AliITSQADataMakerRec *itsQAdm = new AliITSQADataMakerRec(kTRUE,idet,0); //online kTRUE
   itsQAdm->SetWriteExpert() ;
-  itsQAdm->SetRunNumber(runNumber);  
+  itsQAdm->SetRunNumber(runNb);  
   //________________________For the RecPoints____________________________________
   /************************************************/
   TPluginManager* pluginManager=NULL;
@@ -269,13 +269,13 @@ pluginHandler = pluginManager->FindHandler("AliReconstructor", "ITS");
   cout<<"raw tobjarray :"<<objArray<<"\n"<<endl;
   for(Int_t spec = 0 ; spec < 5 ; spec++){
     if(spec==1){
-      itsQAdm->SetEventSpecie(AliRecoParam::kLowMult);
-      AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kLowMult);
+      itsQAdm->SetEventSpecie(AliRecoParam::kCosmic);
+      AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kCosmic);
       itsQAdm->InitRaws();
     }
     else{continue;}
   }
-  itsQAdm->StartOfCycle(AliQAv1::kRAWS,runNumber,kFALSE);
+  itsQAdm->StartOfCycle(AliQAv1::kRAWS,runNb,kFALSE);
   /*********************************************************************/
 
     cout << "Init: " << AliQAv1::kRECPOINTS << endl;
@@ -283,13 +283,13 @@ pluginHandler = pluginManager->FindHandler("AliReconstructor", "ITS");
     cout<<"recpoint tobjarray :"<<objArray1<<"\n"<<endl;
     for(Int_t spec = 0 ; spec < 5 ; spec++){
       if(spec==1){
-       itsQAdm->SetEventSpecie(AliRecoParam::kLowMult);
-       AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kLowMult);
+       itsQAdm->SetEventSpecie(AliRecoParam::kCosmic);
+       AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kCosmic);
        itsQAdm->InitRecPoints();
       }
       else{continue;}
     }
-    itsQAdm->StartOfCycle(AliQAv1::kRECPOINTS,runNumber,kTRUE);
+    itsQAdm->StartOfCycle(AliQAv1::kRECPOINTS,runNb,kTRUE);
 
   /*********************************************************************/
   Int_t iev = 0;
@@ -315,8 +315,8 @@ pluginHandler = pluginManager->FindHandler("AliReconstructor", "ITS");
     /*************************************************/
     cout<<"Beginning Exec"<<endl;
     cout<<"AliQAv1::kRAWS   "<<AliQAv1::kRAWS<<endl;
-    itsQAdm->SetEventSpecie(AliRecoParam::kLowMult);
-    AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kLowMult);
+    itsQAdm->SetEventSpecie(AliRecoParam::kCosmic);
+    AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kCosmic);
     itsQAdm->Exec(AliQAv1::kRAWS,rd);
     /***************************************************/
     //  if(kRecPoints){
@@ -334,8 +334,8 @@ pluginHandler = pluginManager->FindHandler("AliReconstructor", "ITS");
       rpcont->PrepareToRead();
       reconstructor->Reconstruct(rd,fTreeR);
 
-      itsQAdm->SetEventSpecie(AliRecoParam::kLowMult);
-      AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kLowMult)  ; 
+      itsQAdm->SetEventSpecie(AliRecoParam::kCosmic);
+      AliQAv1::Instance()->SetEventSpecie(AliRecoParam::kCosmic)  ; 
       itsQAdm->Exec(AliQAv1::kRECPOINTS,fTreeR);
       cout<<"Finishing Exec"<<endl;
     
@@ -366,7 +366,7 @@ pluginHandler = pluginManager->FindHandler("AliReconstructor", "ITS");
 
 }
 
-void ITSQArecoparam(Int_t runNb,Int_t year,Char_t period[10],Int_t idet=2,Int_t FirstEvt=0, Int_t MaxEvts=1000000)
+void ITSQArecoparam(Int_t runNb=150000,Int_t year=2011,Char_t period[10]="LHC11a",Int_t idet=2,Int_t FirstEvt=0, Int_t MaxEvts=1000000)
 {
   //TString namefile(iFile);
   //if(namefile.Contains("alien"))
@@ -395,17 +395,33 @@ void ITSQArecoparam(Int_t runNb,Int_t year,Char_t period[10],Int_t idet=2,Int_t
     printf("In this run there are not raws files: Exit macro\n");
     return;
   }
-  if(gr->GetEntries() > 10) number=8;
-  else number=3;
+  //if(gr->GetEntries() > 10) number=3;
+  //else number=3;
+  Bool_t chunkok=kFALSE;
+  TString filenamedef; //= gr->GetKey(number,"turl");
+  //printf("-> FILE %s \n",filename);
+  while(chunkok==kFALSE || number<gr->GetEntries())
+    {
+      const char* filename = gr->GetKey(number,"turl");
+      printf("-> FILE %s \n",filename);
+      TString namefile(filename);
+      if(namefile.Contains(".10.root")==kFALSE){chunkok=kTRUE; filenamedef.Form("%s",filename); break;} 
+      else{
+       chunkok=kFALSE;
+       number++;
+      }
+      if(number==gr->GetEntries()-1) {chunkok=kTRUE; filenamedef.Form("%s",filename); break;}       
+    }
+
+  char *filetouse=(char*)filenamedef.Data();//=filenamedef.Data(); //=NULL;
+  //sprintf(filetouse,"%s",(char*)filenamedef.Data());
 
+  printf("File to use = %s\n\n",filetouse);
 
-  const char *filename = gr->GetKey(number,"turl");
-    printf("-> FILE %s \n",filename);
-    //TString namefile(filename);
-    char *filetouse;//=NULL;
-    sprintf(filetouse,"%s",filename);
-    ITSQArecoparam(filetouse,idet,FirstEvt,MaxEvts);
+  Int_t runn=runNb;
 
+  printf("Run: %d \n",runn);
 
+  ITSQArecoparam(filetouse,runn,idet,FirstEvt,MaxEvts);
 
 }
index 44492bd..ab965bb 100644 (file)
 #include <TCanvas.h>
 #include <TLegend.h>
 #include <TMath.h>
+#include <TROOT.h>
 #endif
-void TrendQASDD( Char_t filelist[150]="LHC10b.txt", Char_t filename[20]="FileQAtrend",Char_t pass[7]="pass1",Int_t year=2010, Char_t period[7]="LHC10b", Bool_t kUseOriginalFile=kFALSE , Char_t especiename[50]="LowMultiplicity")
+void TrendQASDD( Char_t filelist[150]="LHC10b.txt", Char_t filename[20]="FileQAtrend",Char_t pass[7]="pass1",Int_t year=2010, Char_t period[7]="LHC10b", Bool_t kDOSuperimpose=kFALSE,Bool_t kUseOriginalFile=kFALSE , Char_t especiename[50]="LowMultiplicity")
 {
+  gROOT->SetStyle("Plain");
   Int_t  m;
   vector<Int_t> n;
   //Char_t FileName[200];//="/home/msicilia/Desktop/createlists";
@@ -44,114 +46,783 @@ void TrendQASDD( Char_t filelist[150]="LHC10b.txt", Char_t filename[20]="FileQAt
   fclose (pFile);
   
   Char_t filepath[200];
-  TH1F *histocharge;
-  TH1F *histochargetrend[2];
-  
+
   char name[100];
   char title[100];
+
+  TH1F *histocharge;
+  TH1F *histochargerp;
+
+  sprintf(name,"histoRAWeventtrend");
+  sprintf(title,"Events used for the QA analysis - RAW");
+  TH1F *histoRAWeventtrend=new TH1F(name,title,n.size(),0.,(float)n.size());
+  histoRAWeventtrend->GetXaxis()->SetTitle("# Run");
+  histoRAWeventtrend->GetXaxis()->SetTicks("-");
+  histoRAWeventtrend->GetXaxis()->SetLabelSize(0.02);
+  histoRAWeventtrend->GetXaxis()->SetTitleSize(0.02);
+  histoRAWeventtrend->GetXaxis()->SetTitleOffset(-2.);
+  histoRAWeventtrend->GetXaxis()->SetTickLength(0.01);
+  histoRAWeventtrend->GetYaxis()->SetTitle("Events");
+  histoRAWeventtrend->GetYaxis()->SetLabelSize(0.02);
+  histoRAWeventtrend->GetYaxis()->SetTitleSize(0.02);
+  histoRAWeventtrend->GetYaxis()->SetTitleOffset(1.5);
+  histoRAWeventtrend->SetMarkerStyle(20);
+  histoRAWeventtrend->SetMarkerColor(1);
+
+  sprintf(name,"histoRPeventtrend");
+  sprintf(title,"Events used for the QA analysis - RP");
+  TH1F *histoRPeventtrend=new TH1F(name,title,n.size(),0.,(float)n.size());
+  histoRPeventtrend->GetXaxis()->SetTitle("# Run");
+  histoRPeventtrend->GetXaxis()->SetTicks("-");
+  histoRPeventtrend->GetXaxis()->SetLabelSize(0.02);
+  histoRPeventtrend->GetXaxis()->SetTitleSize(0.02);
+  histoRPeventtrend->GetXaxis()->SetTitleOffset(-2.);
+  histoRPeventtrend->GetXaxis()->SetTickLength(0.01);
+  histoRPeventtrend->GetYaxis()->SetTitle("Events");
+  histoRPeventtrend->GetYaxis()->SetLabelSize(0.02);
+  histoRPeventtrend->GetYaxis()->SetTitleSize(0.02);
+  histoRPeventtrend->GetYaxis()->SetTitleOffset(1.5);
+  histoRPeventtrend->SetMarkerStyle(24);
+  histoRPeventtrend->SetMarkerColor(4);
+
+
+  TH1F *histoRAWnormevents[3];
+  TH1F *histoRPnormevents[3];
   
-  for(Int_t layer=3;layer<5;layer++)
-    {
-      sprintf(name,"histochargetrend_%d", layer);
-      sprintf(title,"Trend of the Charge of the Layer %d", layer);
-      histochargetrend[layer-3]=new TH1F(name,title,n.size(),0.,(float)n.size());
-    }
-  
-  gStyle->SetOptStat(0);       
-  TCanvas *canvas[6];
-  
-  for(Int_t i=0;i<3;i++)
-    {
-      sprintf(name,"canvas%i",i);
-      canvas[i]=new TCanvas(name,name);
-      canvas[i]->Divide(2,1);
-    }
+  TH1F *histoRAWfilledmodules[3];
+  TH1F *histoRPfilledmodules[3];
+
+  TH1F *histoRAWfilleddr[3];
+  TH1F *histoRPfilleddr[3];
+
+  TH1F *histoRAWactivemodules[3];
+  TH1F *histoRPactivemodules[3];
+
+  TH1F *histoRAWactivedr[3];
+  TH1F *histoRPactivedr[3];
+
+  TH1F *histoRAWoverthmodules[3];
+  TH1F *histoRPoverthmodules[3];
+
+  TH1F *histoRAWoverthdr[3];
+  TH1F *histoRPoverthdr[3];
+
+  TH1F *histochargetrend[2];
+  TH1F *historadiustrend[2];
   
+
+  //index on the histograms
+
+  Int_t event=1;
+  Int_t normevtRAW[3]={2,3,4};
+  Int_t normevtRP[3]={2,3,4};
+
+  Int_t filledmodRAW[3]={6,20,34};
+  Int_t filledmodRP[3] ={6,20,36};
+
+  Int_t filleddrRAW[3]={8,22,36};
+  Int_t filleddrRP[3] ={8,22,38};
+
+  Int_t activemodRAW[3]={5,19,33};
+  Int_t activemodRP[3] ={5,19,35};
+
+  Int_t activedrRAW[3]={7,21,35};
+  Int_t activedrRP[3] ={7,21,37};
+
+  Int_t overthmodRAW[3]={17,31,45};
+  Int_t overthmodRP[3] ={17,33,49};
+
+  Int_t overthdrRAW[3]={18,32,46};
+  Int_t overthdrRP[3] ={18,34,50};
+
+  Int_t chargeindex[2]={31,47};
+  Int_t radiusindex[2]={32,48};
+
+  const TString histoname[3]={"Total","Layer 3","Layer 4"};
+  const TString histolegend[3]={"All","Layer 3","Layer 4"};
+  const TString histolegend2[2]={"Filled","Active"};
+  const TString histolegend3[2]={"Raw","RecPoints"};
+
+  const TString drawoptionevents[3]={"P","PSAME","PSAME"};
+  const TString drawoptionfill[3]={"P","P","PSAME"};
+  const TString drawoptionactive[3]={"PSAME","PSAME","PSAME"};
+
   TLegend *legend =new TLegend(0.83,0.8,0.97,0.2);
   TLegend *legend2=new TLegend(0.83,0.8,0.97,0.2);
+  TLegend *legendevents=new TLegend(0.83,01.,0.97,0.9);
+  TLegend *legendchecks =new TLegend(0.83,1.,0.97,0.9);
+  TLegend *legendchecks2 =new TLegend(0.83,1.,0.97,0.9);
+  TLegend *legendchecks3 =new TLegend(0.83,1.,0.97,0.9);
+  TLegend *legendchecks4 =new TLegend(0.83,1.,0.97,0.9);
 
   Char_t runnmbr[20];
-  Float_t fmax=0;
+  Float_t fmax[2];
+  for(Int_t i=0;i<2;i++)fmax[i]=0;
   Float_t fmaxold=0;
-  Float_t fmaxmargin=0;
+  Float_t fmaxmargin[2];
+  for(Int_t i=0;i<2;i++)fmaxmargin[i]=0;
 
   Float_t fmaxtime=0;
   Float_t fmaxoldtime=0;
-  Float_t fmaxmargintime=0;
+  Float_t fmaxmargintime[2];
+  for(Int_t i=0;i<2;i++)fmaxmargintime[i]=0;
 
   Int_t j=0;
   Int_t hh=0;
-  //Int_t kk=0;
-  char buffer [10];
 
-  printf("%d \n",n.size());
+  for(Int_t ii=0;ii<3;ii++)
+
+    {
+      sprintf(name,"histoRAWnormevent%d", ii);
+      sprintf(title,"Trend of the Norm Events  %s RAW",histoname[ii].Data());
+      histoRAWnormevents[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRAWnormevents[ii]->SetStats(0);
+      histoRAWnormevents[ii]->SetMinimum(0.);
+      histoRAWnormevents[ii]->GetXaxis()->SetTitle("# Run");
+      histoRAWnormevents[ii]->GetXaxis()->SetTicks("-");
+      histoRAWnormevents[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRAWnormevents[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRAWnormevents[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRAWnormevents[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRAWnormevents[ii]->GetYaxis()->SetTitle("entries/(goodch*totevents)");
+      histoRAWnormevents[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRAWnormevents[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRAWnormevents[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRAWnormevents[ii]->SetMarkerStyle(20+ii);
+      histoRAWnormevents[ii]->SetMarkerColor(1+ii);
+
+      sprintf(name,"histoRPnormevent%d", ii);
+      sprintf(title,"Trend of the Norm Events  %s RP", histoname[ii].Data());
+      histoRPnormevents[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRPnormevents[ii]->SetStats(0);
+      histoRPnormevents[ii]->SetMinimum(0.);
+      histoRPnormevents[ii]->GetXaxis()->SetTitle("# Run");
+      histoRPnormevents[ii]->GetXaxis()->SetTicks("-");
+      histoRPnormevents[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRPnormevents[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRPnormevents[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRPnormevents[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRPnormevents[ii]->GetYaxis()->SetTitle("entries/(goodch*totevents)");
+      histoRPnormevents[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRPnormevents[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRPnormevents[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRPnormevents[ii]->SetMarkerStyle(20+ii);
+      histoRPnormevents[ii]->SetMarkerColor(1+ii);
+
+
+      sprintf(name,"histoRAWfilledmodules%d", ii);
+      sprintf(title,"Trend of the filled modules %s RAW", histoname[ii].Data());
+      histoRAWfilledmodules[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRAWfilledmodules[ii]->SetStats(0);
+      histoRAWfilledmodules[ii]->SetMaximum(272.);
+      histoRAWfilledmodules[ii]->SetMinimum(-1.);
+      histoRAWfilledmodules[ii]->GetXaxis()->SetTitle("# Run");
+      histoRAWfilledmodules[ii]->GetXaxis()->SetTicks("-");
+      histoRAWfilledmodules[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRAWfilledmodules[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRAWfilledmodules[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRAWfilledmodules[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRAWfilledmodules[ii]->GetYaxis()->SetTitle("modules");
+      histoRAWfilledmodules[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRAWfilledmodules[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRAWfilledmodules[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRAWfilledmodules[ii]->SetMarkerStyle(20+ii);
+      histoRAWfilledmodules[ii]->SetMarkerColor(1+ii);
+
+      sprintf(name,"histoRPfilledmodules%d", ii);
+      sprintf(title,"Trend of the filled modules %s RP",  histoname[ii].Data());
+      histoRPfilledmodules[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRPfilledmodules[ii]->GetXaxis()->SetTitle("# Run");
+      histoRPfilledmodules[ii]->SetStats(0);
+      histoRPfilledmodules[ii]->SetMaximum(272.);
+      histoRPfilledmodules[ii]->SetMinimum(-1.);
+      histoRPfilledmodules[ii]->GetXaxis()->SetTicks("-");
+      histoRPfilledmodules[ii]->GetYaxis()->SetTitle("modules");
+      histoRPfilledmodules[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRPfilledmodules[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRPfilledmodules[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRPfilledmodules[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRPfilledmodules[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRPfilledmodules[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRPfilledmodules[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRPfilledmodules[ii]->SetMarkerStyle(20+ii);
+      histoRPfilledmodules[ii]->SetMarkerColor(1+ii);
+
+      sprintf(name,"histoRAWfilleddr%d", ii);
+      sprintf(title,"Trend of the filled drift regions %s RAW",  histoname[ii].Data());
+      histoRAWfilleddr[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRAWfilleddr[ii]->GetXaxis()->SetTitle("# Run");
+      histoRAWfilleddr[ii]->SetStats(0);
+      histoRAWfilleddr[ii]->SetMaximum(272.);
+      histoRAWfilleddr[ii]->SetMinimum(-1.);
+      histoRAWfilleddr[ii]->GetXaxis()->SetTicks("-");
+      histoRAWfilleddr[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRAWfilleddr[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRAWfilleddr[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRAWfilleddr[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRAWfilleddr[ii]->GetYaxis()->SetTitle("Drift Regions");
+      histoRAWfilleddr[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRAWfilleddr[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRAWfilleddr[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRAWfilleddr[ii]->SetMarkerStyle(20+ii);
+      histoRAWfilleddr[ii]->SetMarkerColor(1+ii);
+
+      sprintf(name,"histoRPfilleddr%d", ii);
+      sprintf(title,"Trend of the filled drift regions %s RP", histoname[ii].Data());
+      histoRPfilleddr[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRPfilleddr[ii]->SetStats(0);
+      histoRPfilleddr[ii]->SetMaximum(272.);
+      histoRPfilleddr[ii]->SetMinimum(-1.);
+      histoRPfilleddr[ii]->GetXaxis()->SetTitle("# Run");
+      histoRPfilleddr[ii]->GetXaxis()->SetTicks("-");
+      histoRPfilleddr[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRPfilleddr[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRPfilleddr[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRPfilleddr[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRPfilleddr[ii]->GetYaxis()->SetTitle("Drift Regions");
+      histoRPfilleddr[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRPfilleddr[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRPfilleddr[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRPfilleddr[ii]->SetMarkerStyle(20+ii);
+      histoRPfilleddr[ii]->SetMarkerColor(1+ii);
+
+
+      sprintf(name,"histoRAWactivemodules%d", ii);
+      sprintf(title,"Trend of the active module %s RAW",  histoname[ii].Data());
+      histoRAWactivemodules[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRAWactivemodules[ii]->SetStats(0);
+      histoRAWactivemodules[ii]->GetXaxis()->SetTitle("# Run");
+      histoRAWactivemodules[ii]->GetXaxis()->SetTicks("-");
+      histoRAWactivemodules[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRAWactivemodules[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRAWactivemodules[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRAWactivemodules[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRAWactivemodules[ii]->GetYaxis()->SetTitle("modules");
+      histoRAWactivemodules[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRAWactivemodules[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRAWactivemodules[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRAWactivemodules[ii]->SetMarkerStyle(24+ii);
+      histoRAWactivemodules[ii]->SetMarkerColor(4);
+
+
+
+      sprintf(name,"histoRPactivemodules%d", ii);
+      sprintf(title,"Trend of the active modules %s RP",  histoname[ii].Data());
+      histoRPactivemodules[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRPactivemodules[ii]->SetStats(0);
+      histoRPactivemodules[ii]->GetXaxis()->SetTitle("# Run");
+      histoRPactivemodules[ii]->GetXaxis()->SetTicks("-");
+      histoRPactivemodules[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRPactivemodules[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRPactivemodules[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRPactivemodules[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRPactivemodules[ii]->GetYaxis()->SetTitle("modules");
+      histoRPactivemodules[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRPactivemodules[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRPactivemodules[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRPactivemodules[ii]->SetMarkerStyle(24+ii);
+      histoRPactivemodules[ii]->SetMarkerColor(4);
+
+
+      sprintf(name,"histoRAWactivedr%d", ii);
+      sprintf(title,"Trend of the active drift region %s RAW", histoname[ii].Data());
+      histoRAWactivedr[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRAWactivedr[ii]->SetStats(0);
+      histoRAWactivedr[ii]->GetXaxis()->SetTitle("# Run");
+      histoRAWactivedr[ii]->GetXaxis()->SetTicks("-");
+      histoRAWactivedr[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRAWactivedr[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRAWactivedr[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRAWactivedr[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRAWactivedr[ii]->GetYaxis()->SetTitle("Drift Regions");
+      histoRAWactivedr[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRAWactivedr[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRAWactivedr[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRAWactivedr[ii]->SetMarkerStyle(24+ii);
+      histoRAWactivedr[ii]->SetMarkerColor(4);
+
+      sprintf(name,"histoRPactivedr%d", ii);
+      sprintf(title,"Trend of the active drift region %s RP",  histoname[ii].Data());
+      histoRPactivedr[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRPactivedr[ii]->SetStats(0);
+      histoRPactivedr[ii]->GetXaxis()->SetTitle("# Run");
+      histoRPactivedr[ii]->GetXaxis()->SetTicks("-");
+      histoRPactivedr[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRPactivedr[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRPactivedr[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRPactivedr[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRPactivedr[ii]->GetYaxis()->SetTitle("Drift Regions");
+      histoRPactivedr[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRPactivedr[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRPactivedr[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRPactivedr[ii]->SetMarkerStyle(24+ii);
+      histoRPactivedr[ii]->SetMarkerColor(4);
+
+      sprintf(name,"histoRAWoverthmodules%d", ii);
+      sprintf(title,"Trend of the over th modules %s RAW", histoname[ii].Data());
+      histoRAWoverthmodules[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRAWoverthmodules[ii]->SetStats(0);
+      histoRAWoverthmodules[ii]->GetXaxis()->SetTitle("# Run");
+      histoRAWoverthmodules[ii]->GetXaxis()->SetTicks("-");
+      histoRAWoverthmodules[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRAWoverthmodules[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRAWoverthmodules[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRAWoverthmodules[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRAWoverthmodules[ii]->GetYaxis()->SetTitle("modules");
+      histoRAWoverthmodules[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRAWoverthmodules[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRAWoverthmodules[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRAWoverthmodules[ii]->SetMarkerStyle(20+ii);
+      histoRAWoverthmodules[ii]->SetMarkerColor(1+ii);
+
+      sprintf(name,"histoRPoverthmodules%d", ii);
+      sprintf(title,"Trend of the over th modules %s RP",  histoname[ii].Data());
+      histoRPoverthmodules[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRPoverthmodules[ii]->SetStats(0);
+      histoRPoverthmodules[ii]->GetXaxis()->SetTitle("# Run");
+      histoRPoverthmodules[ii]->GetXaxis()->SetTicks("-");
+      histoRPoverthmodules[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRPoverthmodules[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRPoverthmodules[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRPoverthmodules[ii]->GetYaxis()->SetTitle("modules");
+      histoRPoverthmodules[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRPoverthmodules[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRPoverthmodules[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRPoverthmodules[ii]->SetMarkerStyle(20+ii);
+      histoRPoverthmodules[ii]->SetMarkerColor(1+ii);
+
+
+      sprintf(name,"histoRAWoverthdr%d", ii);
+      sprintf(title,"Trend of the over th drift regions %s RAW",  histoname[ii].Data());
+      histoRAWoverthdr[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRAWoverthdr[ii]->SetStats(0);
+      histoRAWoverthdr[ii]->GetXaxis()->SetTitle("# Run");
+      histoRAWoverthdr[ii]->GetXaxis()->SetTicks("-");
+      histoRAWoverthdr[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRAWoverthdr[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRAWoverthdr[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRAWoverthdr[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRAWoverthdr[ii]->GetYaxis()->SetTitle("Drift Regions");
+      histoRAWoverthdr[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRAWoverthdr[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRAWoverthdr[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRAWoverthdr[ii]->SetMarkerStyle(20+ii);
+      histoRAWoverthdr[ii]->SetMarkerColor(1+ii);
+
+
+      sprintf(name,"histoRPoverthdr%d", ii);
+      sprintf(title,"Trend of the over th drift regions %s RP",  histoname[ii].Data());
+      histoRPoverthdr[ii]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histoRPoverthdr[ii]->SetStats(0);
+      histoRPoverthdr[ii]->GetXaxis()->SetTitle("# Run");
+      histoRPoverthdr[ii]->GetXaxis()->SetTicks("-");
+      histoRPoverthdr[ii]->GetXaxis()->SetLabelSize(0.02);
+      histoRPoverthdr[ii]->GetXaxis()->SetTickLength(0.01);
+      histoRPoverthdr[ii]->GetXaxis()->SetTitleSize(0.02);
+      histoRPoverthdr[ii]->GetXaxis()->SetTitleOffset(-2.);
+      histoRPoverthdr[ii]->GetYaxis()->SetTitle("Drift Regions");
+      histoRPoverthdr[ii]->GetYaxis()->SetLabelSize(0.02);
+      histoRPoverthdr[ii]->GetYaxis()->SetTitleSize(0.02);
+      histoRPoverthdr[ii]->GetYaxis()->SetTitleOffset(1.5);
+      histoRPoverthdr[ii]->SetMarkerStyle(20+ii);
+      histoRPoverthdr[ii]->SetMarkerColor(1+ii);
+
+    }
+
+  for(Int_t layer=3;layer<5;layer++)
+    {
+      sprintf(name,"histochargetrend_%d", layer);
+      sprintf(title,"Trend of the Charge of the Layer %d", layer);
+      histochargetrend[layer-3]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      histochargetrend[layer-3]->SetStats(0);
+      histochargetrend[layer-3]->GetXaxis()->SetTicks("-");
+      histochargetrend[layer-3]->GetXaxis()->SetLabelSize(0.02);
+      histochargetrend[layer-3]->GetXaxis()->SetTickLength(0.01);
+      histochargetrend[layer-3]->GetYaxis()->SetTitleSize(0.02);
+      histochargetrend[layer-3]->GetXaxis()->SetTitleOffset(-2.);
+      histochargetrend[layer-3]->GetXaxis()->SetLabelSize(0.02);
+      histochargetrend[layer-3]->GetYaxis()->SetTitleSize(0.02);
+      histochargetrend[layer-3]->GetYaxis()->SetTitleOffset(1.5);
+      histochargetrend[layer-3]->GetXaxis()->SetTitle("# Run");
+      histochargetrend[layer-3]->GetYaxis()->SetTitle("keV");
+      histochargetrend[layer-3]->SetMinimum(0.);
+      histochargetrend[layer-3]->SetMaximum(250.);
+      histochargetrend[layer-3]->SetMarkerStyle(20);
+      histochargetrend[layer-3]->SetMarkerSize(1);
+      histochargetrend[layer-3]->SetMarkerColor(kGreen+4);
+      histochargetrend[layer-3]->SetFillColor(42);
+
+
+      sprintf(name,"historadiustrend_%d", layer);
+      sprintf(title,"Trend of the radius of the Layer %d", layer);
+      historadiustrend[layer-3]=new TH1F(name,title,n.size(),0.,(float)n.size());
+      historadiustrend[layer-3]->SetStats(0);
+      historadiustrend[layer-3]->GetXaxis()->SetTicks("-");
+      historadiustrend[layer-3]->GetXaxis()->SetLabelSize(0.02);
+      historadiustrend[layer-3]->GetXaxis()->SetTickLength(0.01);
+      historadiustrend[layer-3]->GetXaxis()->SetTitleSize(0.02);
+      historadiustrend[layer-3]->GetXaxis()->SetTitleOffset(-2.);
+      historadiustrend[layer-3]->GetYaxis()->SetLabelSize(0.02);
+      historadiustrend[layer-3]->GetYaxis()->SetTitleSize(0.02);
+      historadiustrend[layer-3]->GetYaxis()->SetTitleOffset(1.5);
+      historadiustrend[layer-3]->GetXaxis()->SetTitle("# Run");
+      historadiustrend[layer-3]->GetYaxis()->SetTitle("r [cm]");
+      historadiustrend[layer-3]->SetMinimum(0.);
+      historadiustrend[layer-3]->SetMaximum(26.);
+      historadiustrend[layer-3]->SetMarkerStyle(20);
+      historadiustrend[layer-3]->SetMarkerSize(1);
+      historadiustrend[layer-3]->SetMarkerColor(kGreen+4);
+      historadiustrend[layer-3]->SetFillColor(42);
+    }
   
-  for(Int_t layer=3;layer<5;layer++){
-    for (Int_t irun=0; irun<(Int_t)(n.size());irun++)
-      {
-       if(kUseOriginalFile)sprintf(FileName,"run%d/%s/File.QA.%d.%s.%s.Run.%d.root",n[irun],pass,year,period,pass,n[irun]);
-       else sprintf(FileName, "run%d/%s/%s.root", n[irun],pass,filename);
+
+  gStyle->SetOptStat(0);
+       
+  TCanvas *canvas[12];
+  
+  for(Int_t i=0;i<12;i++)
+    {
+      sprintf(name,"canvas%i",i);
+      //printf("--> %s \n",name);
+      
+      canvas[i]=new TCanvas(name,name);
+
+    }
+  
+  char buffer [10];
+  for (Int_t irun=0; irun<(Int_t)(n.size());irun++)
+    {
+       if(kUseOriginalFile) sprintf(FileName, "run%d/%s/File.QA.%d.%s.%s.Run.%d.root", n[irun],pass,year,period,pass,n[irun]);
+       else sprintf(FileName, "run%d/%s/%s.root", n[irun],pass,filename);         
        
        TFile mergedfile(FileName);
        if(kUseOriginalFile){
-       if(mergedfile.GetKey("ITS")==0x0){
-         printf("Run %d, In this run ITS QA has not been executed.-- Exit file\n",n[irun]);
-         continue;
+         if(mergedfile.GetKey("ITS")==0x0){
+           printf("run %d In this run ITS QA has not been executed.--- Exit file\n",n[irun]);
+           continue;
+         }
        }
-       }
-       if(kUseOriginalFile)sprintf(filepath,"ITS/RecPoints/%s/%s_SDDLay%dTotCh",especiename,especiename,layer);
-       else sprintf(filepath,"%s_SDDLay%dTotCh",especiename,layer);
-       histocharge=(TH1F*)(mergedfile.Get(filepath));   
-       
+       sprintf(buffer, "%d", n[irun]);
+       if(kUseOriginalFile)sprintf(filepath,"ITS/Raws/%s/Expert/%s_SDDRawDataCheck",especiename,especiename);
+       else sprintf(filepath,"%s_SDDRawDataCheck",especiename);        
+       sprintf(runnmbr,"run%d",n[irun]);
+       //printf("%s  %s\n",filepath,runnmbr);  
+       histocharge=(TH1F*)(mergedfile.Get(filepath));
        if(histocharge)
          {
-           sprintf(buffer, "%d", n[irun]);
-           histochargetrend[layer-3]->Fill(buffer,histocharge->GetMean());
-           histochargetrend[layer-3]->SetMinimum(0.);
-           histochargetrend[layer-3]->SetMaximum(250.);
-           histochargetrend[layer-3]->GetXaxis()->SetTitle("# Run");
-           histochargetrend[layer-3]->GetYaxis()->SetTitle("keV");
-           fmax=histocharge->GetMaximum();
-           if (j==0)   { fmaxold=fmax;}
-           if (j!=0) { if(fmaxold<fmax) { fmaxold=fmax;} }
-           j++;
-         }//end if histocharge
+           histoRAWeventtrend->Fill(buffer,(histocharge->GetBinContent(event)));
+         }
        
-       histocharge=NULL;
-       
-       //drift time
-       
-       if(kUseOriginalFile)sprintf(filepath,"ITS/RecPoints/%s/%s_SDDdrifttime_Layer%d",especiename,especiename,layer);
-       else sprintf(filepath,"%s_SDDdrifttime_Layer%d",especiename,layer);
-       histocharge=(TH1F*)(mergedfile.Get(filepath));   
-       
-       if(histocharge)
+       if(kUseOriginalFile)sprintf(filepath,"ITS/RecPoints/%s/Expert/%s_SDDRecPointDataCheck",especiename,especiename);
+       else sprintf(filepath,"%s_SDDRecPointCheck",especiename);       
+       sprintf(runnmbr,"run%d",n[irun]);
+       //printf("%s  %s\n",filepath,runnmbr);  
+       histochargerp=(TH1F*)(mergedfile.Get(filepath));        
+       if(histochargerp)
          {
-           sprintf(buffer, "%d", n[irun]);     
-           fmaxtime=histocharge->GetMaximum();
-           if (j==0)   { fmaxoldtime=fmaxtime;}
-           if (j!=0) { if(fmaxoldtime<fmaxtime) { fmaxoldtime=fmaxtime;} }
-           j++;
-         }//end if histocharge
-       
+           histoRPeventtrend->Fill(buffer,histochargerp->GetBinContent(event));
+         }
+       for(Int_t iindex=0;iindex<3;iindex++)
+         {
+           if(histocharge)
+             {
+               histoRAWnormevents[iindex]->Fill(buffer,histocharge->GetBinContent(normevtRAW[iindex]));  
+               histoRAWfilledmodules[iindex]->Fill(buffer,histocharge->GetBinContent(filledmodRAW[iindex]));       
+               histoRAWfilleddr[iindex]->Fill(buffer,histocharge->GetBinContent(filleddrRAW[iindex]));
+               histoRAWactivemodules[iindex]->Fill(buffer,histocharge->GetBinContent(activemodRAW[iindex]));       
+               histoRAWactivedr[iindex]->Fill(buffer,histocharge->GetBinContent(activedrRAW[iindex]));     
+               histoRAWoverthmodules[iindex]->Fill(buffer,histocharge->GetBinContent(overthmodRAW[iindex]));     
+               histoRAWoverthdr[iindex]->Fill(buffer,histocharge->GetBinContent(overthdrRAW[iindex]));
+             }
+           
+           if(histochargerp)
+             {
+               histoRPnormevents[iindex]->Fill(buffer,histochargerp->GetBinContent(normevtRP[iindex]));
+               histoRPfilledmodules[iindex]->Fill(buffer,histochargerp->GetBinContent(filledmodRP[iindex]));
+               histoRPfilleddr[iindex]->Fill(buffer,histochargerp->GetBinContent(filleddrRP[iindex]));
+               histoRPactivemodules[iindex]->Fill(buffer,histochargerp->GetBinContent(activemodRP[iindex]));
+               histoRPactivedr[iindex]->Fill(buffer,histochargerp->GetBinContent(activedrRP[iindex]));
+               histoRPoverthmodules[iindex]->Fill(buffer,histochargerp->GetBinContent(overthmodRP[iindex]));
+               histoRPoverthdr[iindex]->Fill(buffer,histochargerp->GetBinContent(overthdrRP[iindex]));
+               if(iindex<2){
+                 histochargetrend[iindex]->Fill(buffer,histochargerp->GetBinContent(chargeindex[iindex]));
+                 histochargetrend[iindex]->SetBinError(irun+1,histochargerp->GetBinError(chargeindex[iindex]));
+                 historadiustrend[iindex]->Fill(buffer,histochargerp->GetBinContent(radiusindex[iindex]));
+                 historadiustrend[iindex]->SetBinError(irun+1,histochargerp->GetBinError(radiusindex[iindex]));
+               }
+
+             }
+         }
        histocharge=NULL;
-       
-      }//end for run
-    fmaxmargin=fmaxold;
-    fmaxmargintime=1.023*fmaxoldtime;
-    printf("Max Y Range is %4.1f time %4.1f\n",fmaxmargin,fmaxmargintime);
-    
+       histochargerp=NULL;
+    }//end loop on run
+  
+  canvas[3]->cd();
+  //  histoRAWeventtrend->GetXaxis()->LabelsOption("v");
+  histoRAWeventtrend->Draw("E0");
+  //  histoRPeventtrend->GetXaxis()->LabelsOption("v");
+  histoRPeventtrend->Draw("E0SAME");
+  legendevents->AddEntry(histoRAWeventtrend,histolegend3[0].Data(),"P");
+  legendevents->AddEntry(histoRPeventtrend,histolegend3[1].Data(),"P");
+  legendevents->Draw();
+  canvas[3]->Update();
+  
+  canvas[4]->Divide(2,1);  
+  canvas[4]->cd(1);
+  Char_t legendtext[50];
+  for(Int_t i=0;i<3;i++)
+    {
+      //      histoRAWnormevents[i]->GetXaxis()->LabelsOption("v");
+      histoRAWnormevents[i]->Draw(drawoptionevents[i].Data());
+      //      sprintf(legendtext,"%s %s",histolegend);
+      legendchecks->AddEntry(histoRAWnormevents[i],histolegend[i].Data(),"P");
+    }
+  legendchecks->Draw();
+  canvas[4]->cd(2);
+
+  for(Int_t i=0;i<3;i++)
+    {
+      histoRPnormevents[i]->Draw(drawoptionevents[i].Data());
+      //legendchecks->AddEntry(histoRPnormevent,histolegend[i].Data(),"P");
+
+    }
+  legendchecks->Draw("same");
+  canvas[4]->Update();
+  
+  canvas[5]->Divide(2,1);  
+  canvas[5]->cd(1);
+  for(Int_t i=1;i<3;i++)
+    {
+      //histoRAWfilledmodules[i]->GetXaxis()->LabelsOption("v");
+      histoRAWfilledmodules[i]->Draw(drawoptionfill[i].Data());
+      sprintf(legendtext,"%s %s",histolegend[i].Data(),histolegend2[0].Data());
+      legendchecks2->AddEntry(histoRAWfilledmodules[i],legendtext,"P");
+      //histoRAWactivemodules[i]->GetXaxis()->LabelsOption("v");
+      histoRAWactivemodules[i]->Draw(drawoptionactive[i].Data());
+      sprintf(legendtext,"%s %s",histolegend[i].Data(),histolegend2[1].Data());
+      legendchecks2->AddEntry(histoRAWactivemodules[i],legendtext,"P");
+    }
+  legendchecks2->Draw("same");
+  canvas[5]->cd(2);
+  for(Int_t i=1;i<3;i++)
+    {
+      //histoRPfilledmodules[i]->GetXaxis()->LabelsOption("v");
+      histoRPfilledmodules[i]->Draw(drawoptionfill[i].Data());
+      //histoRPactivemodules[i]->GetXaxis()->LabelsOption("v");
+      histoRPactivemodules[i]->Draw(drawoptionactive[i].Data());
+    }
+  legendchecks2->Draw("same");
+  canvas[5]->Update();
+
+  canvas[6]->Divide(2,1);  
+  canvas[6]->cd(1);
+  for(Int_t i=1;i<3;i++)
+    {
+      //histoRAWfilleddr[i]->GetXaxis()->LabelsOption("v");
+      histoRAWfilleddr[i]->Draw(drawoptionfill[i].Data());
+      //histoRAWactivedr[i]->GetXaxis()->LabelsOption("v");
+      histoRAWactivedr[i]->Draw(drawoptionactive[i].Data());
+    }
+  legendchecks2->Draw("same");
+  canvas[6]->cd(2);
+  for(Int_t i=1;i<3;i++)
+    {
+      //histoRPfilleddr[i]->GetXaxis()->LabelsOption("v");
+      histoRPfilleddr[i]->Draw(drawoptionfill[i].Data());
+      //histoRPactivedr[i]->GetXaxis()->LabelsOption("v");
+      histoRPactivedr[i]->Draw(drawoptionactive[i].Data());
+    }
+  legendchecks2->Draw("same");
+  canvas[6]->Update();
+
+
+
+  ///////////////////////////////////////////////
+
+
+  
+  canvas[10]->Divide(2,1);  
+  canvas[10]->cd(1);
+  
+  //histoRAWfilledmodules[i]->GetXaxis()->LabelsOption("v");
+  histoRAWfilledmodules[0]->Draw(drawoptionfill[0].Data());
+  sprintf(legendtext,"%s %s",histolegend[0].Data(),histolegend2[0].Data());
+  legendchecks3->AddEntry(histoRAWfilledmodules[0],legendtext,"P");
+  //histoRAWactivemodules[i]->GetXaxis()->LabelsOption("v");
+  histoRAWactivemodules[0]->Draw(drawoptionactive[0].Data());
+  sprintf(legendtext,"%s %s",histolegend[0].Data(),histolegend2[1].Data());
+  legendchecks3->AddEntry(histoRAWactivemodules[0],legendtext,"P");
+  legendchecks3->Draw("same");
+  canvas[10]->cd(2);
+  
+  //histoRPfilledmodules[i]->GetXaxis()->LabelsOption("v");
+  histoRPfilledmodules[0]->Draw(drawoptionfill[0].Data());
+  //histoRPactivemodules[i]->GetXaxis()->LabelsOption("v");
+  histoRPactivemodules[0]->Draw(drawoptionactive[0].Data());
+  legendchecks3->Draw("same");
+  canvas[10]->Update();
+  
+  canvas[11]->Divide(2,1);  
+  canvas[11]->cd(1);
+  
+  //histoRAWfilleddr[i]->GetXaxis()->LabelsOption("v");
+  histoRAWfilleddr[0]->Draw(drawoptionfill[0].Data());
+  //histoRAWactivedr[i]->GetXaxis()->LabelsOption("v");
+  histoRAWactivedr[0]->Draw(drawoptionactive[0].Data());
+  legendchecks3->Draw("same");
+  canvas[11]->cd(2);
+  
+  //histoRPfilleddr[i]->GetXaxis()->LabelsOption("v");
+  histoRPfilleddr[0]->Draw(drawoptionfill[0].Data());
+  //histoRPactivedr[i]->GetXaxis()->LabelsOption("v");
+  histoRPactivedr[0]->Draw(drawoptionactive[0].Data());
+  legendchecks3->Draw("same");
+  canvas[11]->Update();
+
+
+  ///////////////////////////////////////////////
+
+  canvas[8]->Divide(2,1);  
+  canvas[8]->cd(1);
+  for(Int_t i=0;i<3;i++)
+    {
+      //histoRAWoverthmodules[i]->GetXaxis()->LabelsOption("v");
+      histoRAWoverthmodules[i]->Draw(drawoptionfill[i].Data());
+      //histoRAWoverthmodules[i]->Draw(drawoptionactive[i].Data());
+    }
+  canvas[8]->cd(2);
+  for(Int_t i=0;i<3;i++)
+    {
+      //histoRPoverthmodules[i]->GetXaxis()->LabelsOption("v");
+      histoRPoverthmodules[i]->Draw(drawoptionfill[i].Data());
+      //histoRPoverthmodules[i]->Draw(drawoptionactive[i].Data());
+    }
+  canvas[8]->Update();
+
+  canvas[9]->Divide(2,1);  
+  canvas[9]->cd(1);
+  for(Int_t i=0;i<3;i++)
+    {
+      histoRAWoverthdr[i]->GetXaxis()->LabelsOption("v");
+      histoRAWoverthdr[i]->Draw(drawoptionfill[i].Data());
+      //histoRAWoverthdr[i]->Draw(drawoptionactive[i].Data());
+    }
+  canvas[9]->cd(2);
+  for(Int_t i=0;i<3;i++)
+    {
+      //histoRPoverthdr[i]->GetXaxis()->LabelsOption("v");
+      histoRPoverthdr[i]->Draw(drawoptionfill[i].Data());
+      //histoRPoverthdr[i]->Draw(drawoptionactive[i].Data());
+    }
+  canvas[9]->Update();
+  
+  //Int_t kk=0;
+
+
+  printf("Total runs: %d \n",(int)(n.size()));
+  canvas[0]->Divide(2,1);
+
+  for(Int_t layer=3;layer<5;layer++){
     canvas[0]->SetFillColor(46);
     canvas[0]->cd(layer-2)->SetFillColor(46);
+    //histochargetrend[layer-3]->GetXaxis()->LabelsOption("v");
     histochargetrend[layer-3]->SetMarkerStyle(20);
     histochargetrend[layer-3]->SetMarkerSize(1);
     histochargetrend[layer-3]->SetMarkerColor(kGreen+4);
     histochargetrend[layer-3]->SetFillColor(42);
     canvas[0]->cd(layer-2)->SetFrameFillColor(kAzure-9);
+    //    histochargetrend[layer-3]->GetXaxis()->LabelsOption("v");
     histochargetrend[layer-3]->SetBarWidth(0.9);
     histochargetrend[layer-3]->SetBarOffset(0.05);
     histochargetrend[layer-3]->DrawCopy("P");
+    canvas[0]->Update();
  
+    canvas[7]->cd();
+    canvas[7]->SetFillColor(46);
+    //canvas[7]->SetFillColor(46);
+    //historadiustrend[layer-3]->GetXaxis()->LabelsOption("v");
+    historadiustrend[layer-3]->SetMarkerStyle(20);
+    historadiustrend[layer-3]->SetMarkerSize(1);
+    historadiustrend[layer-3]->SetMarkerColor(8+layer-3);
+    legendchecks4->AddEntry(historadiustrend[layer-3],histolegend[layer-2].Data(),"P");
+    //historadiustrend[layer-3]->SetFillColor(42);
+    canvas[7]->SetFrameFillColor(kAzure-9);
+    historadiustrend[layer-3]->SetBarWidth(0.9);
+    historadiustrend[layer-3]->SetBarOffset(0.05);
+    historadiustrend[layer-3]->DrawCopy(drawoptionevents[layer-3].Data());
+    canvas[7]->Update();
+  }
+  legendchecks4->Draw("same");
+  canvas[7]->Update();
+  canvas[1]->Divide(2,1);
+  canvas[2]->Divide(2,1);
+  //canvas[7]->Divide(2,1);
+  
+  if(kDOSuperimpose==kTRUE)
+    {
+      Int_t jj=0;
+      for (Int_t irun=0; irun<(Int_t)(n.size());irun++)
+       {
+         for(Int_t ilayer=3;ilayer<5;ilayer++)
+           {
+           if(kUseOriginalFile)sprintf(FileName,"run%d/%s/File.QA.%d.%s.%s.Run.%d.root",n[irun],pass,year,period,pass,n[irun]);
+           else sprintf(FileName, "run%d/%s/%s.root", n[irun],pass,filename);
+           
+           TFile mergedfile(FileName);
+           
+           if(kUseOriginalFile){
+             if(mergedfile.GetKey("ITS")==0x0){
+               printf("Run %d, In this run ITS QA has not been executed.-- Exit file\n",n[irun]);
+               continue;
+             }
+           }
+           if(kUseOriginalFile)sprintf(filepath,"ITS/RecPoints/%s/%s_SDDLay%dTotCh",especiename,especiename,ilayer);
+           else sprintf(filepath,"%s_SDDLay%dTotCh",especiename,ilayer);
+           histocharge=(TH1F*)(mergedfile.Get(filepath));       
+           
+           if(histocharge)
+             {
+               sprintf(buffer, "%d", n[irun]);
+               
+               fmax[ilayer-3]=histocharge->GetMaximum();
+               if (jj==0)      { fmaxold=fmax[ilayer-3];}
+               if (jj!=0) { if(fmaxold<fmax[ilayer-3]) { fmaxold=fmax[ilayer-3];} }
+               //j++;
+             }//end if histocharge
+           
+           histocharge=NULL;
+           
+           //drift time
+           
+           if(kUseOriginalFile)sprintf(filepath,"ITS/RecPoints/%s/%s_SDDdrifttime_Layer%d",especiename,especiename,ilayer);
+           else sprintf(filepath,"%s_SDDdrifttime_Layer%d",especiename,ilayer);
+           histocharge=(TH1F*)(mergedfile.Get(filepath));       
+           
+           if(histocharge)
+             {
+               sprintf(buffer, "%d", n[irun]); 
+               fmaxtime=histocharge->GetMaximum();
+               if (jj==0)      { fmaxoldtime=fmaxtime;}
+               if (jj!=0) { if(fmaxoldtime<fmaxtime) { fmaxoldtime=fmaxtime;} }
+               //j++;
+             }//end if histocharge
+           jj++;
+           histocharge=NULL;
+           
+         }//end for run
+       }//end layer
+
+    fmaxmargin[0]=fmaxold;
+    fmaxmargintime[0]=1.023*fmaxoldtime;
+  
+
+    fmaxmargin[1]=fmaxmargin[0];
+    fmaxmargintime[1]=fmaxmargintime[0];
+
+
+  for(Int_t layer=3;layer<5;layer++){
+  
+    printf("Max Y Range is %4.1f time %4.1f\n",fmaxmargin[layer-3],fmaxmargintime[layer-3]);  
     j=0;
     hh=0;
     Int_t color=0;
@@ -163,10 +834,10 @@ void TrendQASDD( Char_t filelist[150]="LHC10b.txt", Char_t filename[20]="FileQAt
        
        TFile mergedfile(FileName);
        if(kUseOriginalFile){
-       if(mergedfile.GetKey("ITS")==0x0){
-         printf("run %d In this run ITS QA has not been executed.--- Exit file\n",n[irun]);
-         continue;
-       }
+         if(mergedfile.GetKey("ITS")==0x0){
+           printf("run %d In this run ITS QA has not been executed.--- Exit file\n",n[irun]);
+           continue;
+         }
        }       
        if(kUseOriginalFile)sprintf(filepath,"ITS/RecPoints/%s/%s_SDDLay%dTotCh",especiename,especiename,layer);
        else sprintf(filepath,"%s_SDDLay%dTotCh",especiename,layer);    
@@ -183,22 +854,23 @@ void TrendQASDD( Char_t filelist[150]="LHC10b.txt", Char_t filename[20]="FileQAt
                canvas[1]->cd(layer-2);
 
                canvas[1]->cd(layer-2)->SetFrameFillColor(kGray+3);
-               histocharge->SetMaximum(fmaxmargin);
+               histocharge->SetMaximum(fmaxmargin[layer-3]);
                histocharge->GetYaxis()->SetTitle("");
                histocharge->DrawNormalized();
-               histocharge->SetMaximum(fmaxmargin);
+               canvas[1]->cd(layer-2)->Update();
+               histocharge->GetYaxis()->SetRangeUser(0.,fmaxmargin[layer-3]);
                canvas[1]->cd(layer-2)->Update();
              }    
            if (j!=0)
              {
-       
+               //printf("new j %d\n",j);
                canvas[1]->cd(layer-2);
                histocharge->DrawNormalized("same");
                canvas[1]->cd(layer-2)->Update();
              }     
            if(layer==3)legend->AddEntry(histocharge,runnmbr,"l");
            canvas[1]->cd(layer-2);
-           legend->Draw();         
+           legend->Draw("same");           
            canvas[1]->Update();
            j++;
            printf("...Found\n");
@@ -221,10 +893,9 @@ void TrendQASDD( Char_t filelist[150]="LHC10b.txt", Char_t filename[20]="FileQAt
              { 
                canvas[2]->cd(layer-2);
                canvas[2]->cd(layer-2)->SetFrameFillColor(kGray+3);
-               histocharge->SetMaximum(fmaxmargintime);
+               histocharge->SetMaximum(fmaxmargintime[layer-3]);
                histocharge->GetYaxis()->SetTitle("");
                histocharge->DrawNormalized();
-               histocharge->SetMaximum(fmaxmargintime);
              }    
            if (hh!=0)
              {
@@ -233,7 +904,7 @@ void TrendQASDD( Char_t filelist[150]="LHC10b.txt", Char_t filename[20]="FileQAt
              }     
            if(layer==3)legend2->AddEntry(histocharge,runnmbr,"l");
            canvas[2]->cd(layer-2);
-           legend2->Draw();        
+           legend2->Draw("same");          
            canvas[2]->Update();
            hh++;
          }//end if histocharge
@@ -241,21 +912,22 @@ void TrendQASDD( Char_t filelist[150]="LHC10b.txt", Char_t filename[20]="FileQAt
        histocharge=NULL;
       }//enf for 
       }//end for layer
+    }
   
   TFile trendfile(Form("SDDQAtrend%s%s.root",period,pass),"recreate");  
   trendfile.cd();
-  for(Int_t ican=0;ican<3;ican++)canvas[ican]->Write();
+  for(Int_t ican=0;ican<10;ican++)canvas[ican]->Write();
   trendfile.Close();
   Char_t psfile[50];
   sprintf(psfile,"SDDtrend%s%s.ps",period,pass);
   canvas[0]->Print(Form("%s[",psfile));
-  for(Int_t ifile=0;ifile<3;ifile++){canvas[ifile]->Print(psfile);}
-
-  canvas[2]->Print(Form("%s]",psfile));
+  for(Int_t ifile=0;ifile<12;ifile++){canvas[ifile]->Print(psfile);}
 
+  canvas[11]->Print(Form("%s]",psfile));
+  
   
   delete histocharge;
-       
+  delete histochargerp;