]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Classes for Quality Assurance. Presently only SDD is monitored. (Cerello, Ferrarese...
authormasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Nov 2007 12:02:04 +0000 (12:02 +0000)
committermasera <masera@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Nov 2007 12:02:04 +0000 (12:02 +0000)
ITS/AliITSQAChecker.cxx [new file with mode: 0644]
ITS/AliITSQAChecker.h [new file with mode: 0644]
ITS/AliITSQADataMaker.cxx [new file with mode: 0644]
ITS/AliITSQADataMaker.h [new file with mode: 0644]
ITS/ITSrecLinkDef.h
ITS/libITSrec.pkg

diff --git a/ITS/AliITSQAChecker.cxx b/ITS/AliITSQAChecker.cxx
new file mode 100644 (file)
index 0000000..05a5ce4
--- /dev/null
@@ -0,0 +1,39 @@
+/**************************************************************************
+ * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+// *****************************************
+//  Checks the quality assurance 
+//  by comparing with reference data
+//  W. Ferrarese Oct 2007
+//  INFN Torino
+
+// --- ROOT system ---
+
+
+// --- AliRoot header files ---
+#include "AliITSQAChecker.h"
+
+ClassImp(AliITSQAChecker)
+
+//__________________________________________________________________
+AliITSQAChecker& AliITSQAChecker::operator = (const AliITSQAChecker& qac )
+{
+  // Equal operator.
+  this->~AliITSQAChecker();
+  new(this) AliITSQAChecker(qac);
+  return *this;
+}
diff --git a/ITS/AliITSQAChecker.h b/ITS/AliITSQAChecker.h
new file mode 100644 (file)
index 0000000..3407a60
--- /dev/null
@@ -0,0 +1,39 @@
+#ifndef ALIITSQACHECKER_H
+#define ALIITSQACHECKER_H
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+/* $Id$ */
+
+//
+//  Checks the quality assurance. 
+//  By comparing with reference data
+//  INFN Torino
+//  W. Ferrarese Oct 2007
+//
+
+
+// --- ROOT system ---
+class TFile ; 
+class TH2F ;  
+
+// --- AliRoot header files ---
+#include "AliQACheckerBase.h"
+class AliITSLoader ; 
+
+class AliITSQAChecker: public AliQACheckerBase {
+
+public:
+  AliITSQAChecker() : AliQACheckerBase("ITS","SDD Quality Assurance Data Maker") {;}          // ctor
+  AliITSQAChecker(const AliITSQAChecker& qac) : AliQACheckerBase(qac.GetName(), qac.GetTitle()) {;} // cpy ctor   
+  AliITSQAChecker& operator = (const AliITSQAChecker& qac) ; //operator =
+  virtual ~AliITSQAChecker() {;} // dtor
+
+private:
+  
+  ClassDef(AliITSQAChecker,1)  // description 
+
+};
+
+#endif // AliITSQAChecker_H
diff --git a/ITS/AliITSQADataMaker.cxx b/ITS/AliITSQADataMaker.cxx
new file mode 100644 (file)
index 0000000..1fdc3a3
--- /dev/null
@@ -0,0 +1,327 @@
+/**************************************************************************
+ * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+//  *************************************************************
+//  Checks the quality assurance 
+//  by comparing with reference data
+//  contained in a DB
+//  -------------------------------------------------------------
+//  W. Ferrarese Nov 2007
+//  INFN Torino
+
+// --- ROOT system ---
+#include <TH2D.h>
+#include <TBranch.h>
+#include <TTree.h>
+#include <TGaxis.h>
+
+// --- Standard library ---
+
+// --- AliRoot header files ---
+#include "AliITSQADataMaker.h"
+#include "AliQA.h"
+#include "AliQAChecker.h"
+#include "AliRawReader.h"
+#include "AliITSRawStreamSDD.h"
+#include "AliITSRecPoint.h"
+#include "AliITSgeomTGeo.h"
+#include "AliRawReader.h"
+
+ClassImp(AliITSQADataMaker)
+
+//____________________________________________________________________________ 
+AliITSQADataMaker::AliITSQADataMaker() : 
+  AliQADataMaker(AliQA::GetDetName(AliQA::kITS), "SDD Quality Assurance Data Maker")
+{ 
+  // ctor 
+}
+
+//____________________________________________________________________________ 
+AliITSQADataMaker::AliITSQADataMaker(Bool_t kMode, Int_t ldc) :
+  AliQADataMaker(AliQA::GetDetName(AliQA::kITS), "SDD Quality Assurance Data Maker")
+{
+  //ctor used to discriminate OnLine-Offline analysis
+  fkOnline = kMode;
+  fLDC = ldc; 
+}
+
+//____________________________________________________________________________ 
+AliITSQADataMaker::AliITSQADataMaker(const AliITSQADataMaker& qadm) :
+  AliQADataMaker()
+{
+  //copy ctor 
+  SetName((const char*)qadm.GetName()) ; 
+  SetTitle((const char*)qadm.GetTitle()); 
+}
+
+//__________________________________________________________________
+AliITSQADataMaker& AliITSQADataMaker::operator = (const AliITSQADataMaker& qac )
+{
+  // Equal operator.
+  this->~AliITSQADataMaker();
+  new(this) AliITSQADataMaker(qac);
+  return *this;
+}
+
+//____________________________________________________________________________ 
+void AliITSQADataMaker::StartOfDetectorCycle() const
+{
+  //Detector specific actions at start of cycle
+  cout<<"AliITSQADM::Start of ITS Cycle"<<endl;
+}
+
+//____________________________________________________________________________ 
+void AliITSQADataMaker::EndOfDetectorCycle(AliQA::TASKINDEX task, TList *list)
+{
+  // launch the QA checking
+  cout <<"AliITSDM instantiates checker with Run(AliQA::kITS, task, list)" << endl;
+  printf( "AliQA::GetQADataFileName() is :  %s \n",AliQA::GetQADataFileName());
+  printf( "AliQA::GetQARefFileName() is :  %s \n",AliQA::GetQARefFileName());
+  printf( "AliQA::GetQAResultFileName() is :  %s \n",AliQA::GetQAResultFileName());
+  AliQAChecker::Instance()->Run( AliQA::kITS , task, list);
+}
+
+//____________________________________________________________________________ 
+void AliITSQADataMaker::EndOfDetectorCycle(const char * fgDataName)
+{
+  //eventually used for different  AliQAChecker::Instance()->Run
+}
+
+//____________________________________________________________________________ 
+void AliITSQADataMaker::InitRaws()
+{  
+  // create SDD histo of raw
+  
+  Int_t lay, lad, det;
+  
+  if(fkOnline) cout << "Book Online Histograms" <<endl;
+  else cout << "Book Offline Histograms" <<endl;
+  Char_t *hname[3][2 * fgknSDDmodules] ;
+  for(Int_t moduleSDD =0; moduleSDD<fgknSDDmodules; moduleSDD++){
+    for(Int_t iside=0;iside<fgknSide;iside++){
+      Int_t index1 = moduleSDD * 2 + iside ;
+      for(Int_t i=0; i<3; i++) hname[i][index1]= new Char_t[50];
+      sprintf(hname[0][index1],"chargeMap%dSide%d",moduleSDD,iside);
+      sprintf(hname[1][index1],"Total Charge, module number %d , Side%d",moduleSDD,iside);
+      sprintf(hname[2][index1],"hmonoDMap%dSide%d",moduleSDD,iside);
+      fModuleChargeMap[index1] = new TH2D(hname[0][index1],hname[1][index1],256,-0.5,255.5,256,-0.5,255.5);
+      fmonoD[index1] = new TH1D(hname[2][index1],hname[2][index1],256,-0.5,255.5);
+    }
+  }
+
+  TH1F *h0 = new TH1F("ModPattern","Modules pattern",fgknSDDmodules,-0.5,259.5); 
+  Add2RawsList(h0,0);
+  TH1F *h1 = new TH1F("ModPatternL3","Modules pattern L3",14,0.5,14.5);  
+  Add2RawsList(h1,1);
+  TH1F *h2 = new TH1F("ModPatternL4","Modules pattern L4",22,0.5,22.5);  
+  Add2RawsList(h2,2);
+
+  Char_t *hname0[fgkLADDonLAY3] ; 
+  TH1D *h3[fgkLADDonLAY3] ; 
+  for(Int_t i=1; i<=fgkLADDonLAY3; i++) {
+    hname0[i] = new Char_t[20];
+    sprintf(hname0[i],"ModPattern_L3_%d",i);
+    h3[i] = new TH1D(hname0[i],hname0[i],6,0.5,6.5);
+    Add2RawsList(h3[i],i-1+3);
+  }
+
+  Char_t *hname1[fgkLADDonLAY4] ;
+  TH1D *h4[fgkLADDonLAY4] ; 
+  for(Int_t i=1; i<=fgkLADDonLAY4; i++) {
+    hname1[i] = new Char_t[20];
+    sprintf(hname1[i],"ModPattern_L4_%d",i);
+    h4[i] = new TH1D(hname1[i],hname1[i],8,0.5,8.5);
+    Add2RawsList(h4[i],i-1+17);  
+  }
+
+  Char_t *hname2[fgknSDDmodules*2] ;
+  TH1D *h5[fgknSDDmodules*2] ; 
+  for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
+    for(Int_t iside=0; iside<fgknSide; iside++){
+      Int_t index1 = moduleSDD * 2 + iside;
+      hname2[index1] = new Char_t[50];
+      sprintf(hname2[index1],"ProjYMap%dSide%d",moduleSDD,iside);
+      h5[index1] = new TH1D(hname2[index1],hname2[index1],256,-0.5,255.5);
+      Add2RawsList(h5[index1],index1+39);
+    }
+  }
+  Char_t *hname3[fgknSDDmodules*8] ;
+  TH1D *h6[fgknSDDmodules*8] ; 
+  for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
+    for(Int_t iside=0; iside<fgknSide; iside++){
+      Int_t index1 = moduleSDD * 2 + iside;
+      for(Int_t htype=0; htype<4; htype++){
+       hname3[index1 + htype *2 * fgknSDDmodules] = new Char_t[50]; 
+      } 
+      AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
+      sprintf(hname3[index1 ],"CountsVSAnode_L%d_%d_%d_%d",lay,lad,det,iside);
+      sprintf(hname3[index1 + 1 *2* fgknSDDmodules],"ChargeVSAnode_L%d_%d_%d_%d",lay,lad,det,iside);
+      sprintf(hname3[index1 + 2 *2* fgknSDDmodules],"CountsVSTbin_L%d_%d_%d_%d",lay,lad,det,iside);
+      sprintf(hname3[index1 + 3 *2* fgknSDDmodules],"ChargeVSTbin_L%d_%d_%d_%d",lay,lad,det,iside);
+
+      for(Int_t htype=0; htype<4; htype++){   
+       Int_t index1 = moduleSDD * 2 + iside;
+       Int_t indextot = index1 + htype* 2 * fgknSDDmodules;
+       h6[indextot] = new TH1D(hname3[indextot],hname3[indextot],256,-0.5,255.5);
+       Add2RawsList(h6[indextot],39 + fgknSDDmodules*2 + indextot);
+      } 
+    }
+  }
+
+  
+  Char_t *hname4[fgknSDDmodules*2];
+  TH2D *h7[fgknSDDmodules*2] ;
+  for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
+    for(Int_t iside=0; iside<fgknSide; iside++){
+      Int_t index1 = moduleSDD * 2 + iside;
+      AliITSgeomTGeo::GetModuleId(moduleSDD+fgkmodoffset, lay, lad, det);
+      hname4[index1] = new Char_t[50]; 
+      sprintf(hname4[index1],"Anode_vs_Charge_L%d_%d_%d_%d",lay,lad,det,iside);
+      h7[index1] = new TH2D(hname4[index1],hname4[index1],fgknSDDmodules*2,-0.5,-0.5+fgknSDDmodules*2,256,0.5,256.5);
+      Add2RawsList(h7[index1],2639 + index1);
+    }
+  }
+
+
+}
+
+//____________________________________________________________________________
+void AliITSQADataMaker::MakeRaws(AliRawReader* rawReader)
+{ 
+  //Fills Raw QA list of histos
+
+  cout<<"entering MakeRaws" <<endl;
+  rawReader->RequireHeader(kFALSE);               
+  rawReader->SelectEvents(7);                    
+  rawReader->SelectEquipment(17,fgkeqOffset+1,fgkeqOffset + fgkDDLidRange); 
+  rawReader->Reset();                         
+  AliITSRawStreamSDD s(rawReader); 
+  Int_t lay, lad, det; 
+
+  Int_t cnt = 0;
+  while(s.Next()){
+    Int_t iddl = rawReader->GetDDLID() - fgkDDLIDshift;
+    Int_t isddmod = s.GetModuleNumber(iddl,s.GetCarlosId());
+    //if(isddmod >= fgkmodoffset && isddmod<fgkmodoffset+fgknSDDmodules ) {
+      Int_t coord1 = s.GetCoord1();
+      Int_t coord2 = s.GetCoord2();
+      Int_t signal = s.GetSignal();
+      Int_t moduleSDD = isddmod - fgkmodoffset;
+      GetRawsData(0)->Fill(moduleSDD); 
+
+      AliITSgeomTGeo::GetModuleId(isddmod, lay, lad, det);
+      //printf("modnumb %d, lay %d, lad %d, det %d \n",isddmod, lay, lad, det);
+      Int_t ioffset = 3;
+      Int_t iorder = 1;
+      if(lay==4) { 
+       ioffset += 14;
+       iorder = 2;   
+      } 
+      GetRawsData(iorder)->Fill(lad);
+      GetRawsData(ioffset+lad-1)->Fill(det); //-1 because ladder# starts from 1    
+
+      Short_t iside = s.GetChannel();
+      Int_t index1 = moduleSDD * 2 + iside;
+      //      if(s.IsCompletedModule()) continue; 
+      fModuleChargeMap[index1]->Fill(coord2, coord1, signal);
+       
+      // ITS.QA.1209.0.root
+      GetRawsData(39+ 2 * fgknSDDmodules + index1)->Fill(coord1); //coord1=anode COvsAN ok
+      GetRawsData(39+ 4 * fgknSDDmodules + index1)->Fill(coord1,signal);  //CHvsAN no
+      GetRawsData(39+ 6 * fgknSDDmodules + index1)->Fill(coord2);      //COvsTB no
+      GetRawsData(39+ 8 * fgknSDDmodules + index1)->Fill(coord2,signal); //CHvsTB ok
+      
+      GetRawsData(2639+index1)->Fill(signal,coord1);
+    //}
+    cnt++;
+    if(!(cnt%10000)) cout << cnt << " raw digits read" << endl;
+  }
+  cout << "Event completed, " << cnt << " raw digits read" << endl;
+
+  for(Int_t moduleSDD=0; moduleSDD<fgknSDDmodules; moduleSDD++){
+    for(Int_t iside=0; iside<fgknSide; iside++){
+      Int_t index1 = moduleSDD * 2 + iside;
+      //if(s.IsCompletedModule()) continue;
+      fmonoD[index1] = fModuleChargeMap[index1]->ProjectionY();
+      Int_t nBins = 256;
+      for(Int_t bin=0; bin<nBins; bin++){
+       GetRawsData(index1+39)->Fill(bin,fmonoD[index1]->GetBinContent(bin+1) );
+      }
+    }
+  }  
+
+}
+
+
+
+//____________________________________________________________________________ 
+void AliITSQADataMaker::InitRecPoints()
+{
+  // create SDD histo of RecPoints
+  
+  TH1F * h0 = new TH1F("Lay3TotCh","Layer 3 total charge",1000,-0.5, 499.5);
+  Add2RecPointsList(h0, 0);
+  TH1F * h1 = new TH1F("Lay4TotCh","Layer 4 total charge",1000,-0.5, 499.5);
+  Add2RecPointsList(h1, 1);
+
+    
+  Char_t *hisnam[3];
+  TH1F *h2[3]; 
+  for(Int_t i=1; i<=3; i++){
+    hisnam[i] = new Char_t[50];
+    sprintf(hisnam[i],"Charge_L3_Strip%d",i);
+    h2[i] = new TH1F(hisnam[i],hisnam[i],1000,-0.5, 499.5);
+    Add2RecPointsList(h2[i],i+1);
+  }
+  
+  Char_t *hisnam2[4] ;
+  TH1F *h3[4]; 
+  for(Int_t i=1; i<=4; i++){
+    hisnam2[i] = new Char_t[50];
+    sprintf(hisnam2[i],"Charge_L4_Strip%d",i);
+    h3[i] = new TH1F(hisnam2[i],hisnam2[i],1000,-0.5, 499.5);
+    Add2RecPointsList(h3[i],i+4);
+  }
+  
+}
+
+
+//____________________________________________________________________________ 
+void AliITSQADataMaker::MakeRecPoints(TTree * clustersTree)
+{
+  // makes data from RecPoints
+  
+  TBranch *branchRecP = clustersTree->GetBranch("ITSRecPoints");
+  if (!branchRecP) { 
+    AliError("can't get the branch with the ITS clusters !");
+    return;
+  }
+  TObjArray * recpoints = new TObjArray(100) ;
+  branchRecP->SetAddress(&recpoints);
+  branchRecP->GetEntry(0);
+  
+  TIter next(recpoints);
+  AliITSRecPoint * rp;
+  while ( rp = dynamic_cast<AliITSRecPoint *>(next())  ) {
+    if(rp->GetLayer() ==3) GetRecPointsData(0)->Fill( rp->GetQ()) ;
+    else if(rp->GetLayer() ==4) GetRecPointsData(1)->Fill( rp->GetQ()) ;
+  }
+  recpoints->Delete();
+  delete recpoints;
+  
+}
diff --git a/ITS/AliITSQADataMaker.h b/ITS/AliITSQADataMaker.h
new file mode 100644 (file)
index 0000000..aa92614
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef ALIITSQADATAMAKER_H
+#define ALIITSQADATAMAKER_H
+/* Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+
+/* $Id$ */
+
+//
+//  Checks the quality assurance. 
+//  By comparing with reference data
+//  contained in a DB
+//
+//
+//  W. Ferrarese Nov 2007
+
+
+
+
+#include "AliQADataMaker.h"
+class TList;
+class TH1F;
+class TH2D;
+class AliRawReader;
+class AliITSgeomTGeo;
+
+class AliITSQADataMaker: public AliQADataMaker {
+
+public:
+  AliITSQADataMaker();          // ctor
+  AliITSQADataMaker(Bool_t kMode, Int_t ldc);
+  AliITSQADataMaker(const AliITSQADataMaker& qadm);
+  AliITSQADataMaker& operator = (const AliITSQADataMaker& qac);
+  virtual void StartOfDetectorCycle() const;
+  virtual void EndOfDetectorCycle(AliQA::TASKINDEX task, TList * list);
+  virtual void EndOfDetectorCycle(const char * fgDataName);
+  virtual void InitRaws();
+  virtual void InitRecPoints();
+  virtual void MakeRaws(AliRawReader *rawReader);
+  virtual void MakeRecPoints(TTree *clustersTree);
+  virtual ~AliITSQADataMaker() {;} // dtor
+
+private:
+
+  static const Int_t fgknSDDmodules = 260; //number of SDD modules
+  static const Int_t fgkmodoffset = 240;   //number of SPD modules
+  static const Int_t fgknAnode = 256;      //anode per half-module
+  static const Int_t fgknSide =2;          //side per module
+  static const Int_t fgkeqOffset = 256;    //DDL offset
+  static const Int_t fgkDDLidRange = 24;   //number of DDL:so DDL range is 257-280
+  static const Int_t fgkDDLIDshift = 0;    //necessary option until RawStream Table is complete
+  static const Int_t fgkLADDonLAY3 = 14;   //number of ladder on layer 3
+  static const Int_t fgkLADDonLAY4 = 22;   //number of ladder on layer 4
+       
+  Bool_t  fkOnline;                         //online (1) or offline (0) use
+  Int_t   fLDC;                            //LDC number (0 for offline, 1 to 4 for online) 
+  TH2D *fModuleChargeMap[2*fgknSDDmodules];//module map
+  TH1D *fmonoD[2*fgknSDDmodules] ;         //histo used as support
+  ClassDef(AliITSQADataMaker,1)  // description 
+
+};
+
+#endif
index cc3e3b5129768324a95cbb81cb9566e6c044d40e..dbe6b362d98890fbb50363bdca3b4317ee6b4542 100644 (file)
 
 // Classes for alignment
 #pragma link C++ class AliITSAlignMille+;
+// Classes for QA
+#pragma link C++ class AliITSQAChecker+;
+#pragma link C++ class AliITSQADataMaker+;
 
 #endif
index 14da84e2ccd9274d1cf821eb4b90f12a20735666..43555588fec2d12d4e02cfa66a6c3078b584a30c 100644 (file)
@@ -83,6 +83,8 @@ SRCS =        AliITSDetTypeRec.cxx \
                 AliITSOnlineSDDCMN.cxx \
                AliITSPreprocessorSSD.cxx \
                AliITSAlignMille.cxx \
+               AliITSQAChecker.cxx \
+               AliITSQADataMaker.cxx \
 
 HDRS:=  $(SRCS:.cxx=.h)