]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HMPID/AliHMPIDDigit.cxx
merge trending into current dir instead of terget dir
[u/mrichter/AliRoot.git] / HMPID / AliHMPIDDigit.cxx
index d9a8ab5213006f439c2d675f311a0d623b50acc3..c922cfe60668f77ee5c2b5ac92742221b943b3ed 100644 (file)
 #include "AliHMPIDDigit.h"    //class header
 #include <TClonesArray.h>     //WriteRaw() 
 #include <TBox.h>             //Draw() 
 #include "AliHMPIDDigit.h"    //class header
 #include <TClonesArray.h>     //WriteRaw() 
 #include <TBox.h>             //Draw() 
-#include <AliRawDataHeader.h> //WriteRaw()
+#include <TPolyLine.h>        //Draw() 
+#include "AliHMPIDParam.h"
 #include <AliDAQ.h>           //WriteRaw()
 #include <AliDAQ.h>           //WriteRaw()
-#include <Riostream.h>        //WriteRaw()
-ClassImp(AliHMPIDDigit)
-
-const Float_t AliHMPIDDigit::fMinPcX[]={ 0.00 ,  66.60 ,   0.00 ,  66.60 ,  0.00 ,  66.60};
-const Float_t AliHMPIDDigit::fMaxPcX[]={64.00 , 130.60 ,  64.00 , 130.60 , 64.00 , 130.60};
-
-const Float_t AliHMPIDDigit::fMinPcY[]={ 0.00 , 42.92 ,  85.84,   0.00 , 42.92 ,  85.84};
-const Float_t AliHMPIDDigit::fMaxPcY[]={40.32 , 83.24 , 126.16,  40.32 , 83.24 , 126.16};
+#include "Riostream.h"        //WriteRaw()
+#include "AliFstream.h"   
 
 
+ClassImp(AliHMPIDDigit)
 
 /*
 
 /*
+ Preface: all geometrical information (like left-right sides) is reported as seen from electronic side.
+      d10          d1    d10           d1 
+      _______________    _______________          
+r1   |               |  |               |126.16   r24
+     |       4       |  |       5       | 
+     |               |  |               | 
+     |_______________|  |_______________|85.84 
+      _______________    _______________
+     |               |  |               |83.24  
+     |       2       |  |       3       |
+     |               |  |               |             
+     |_______________|  |_______________|42.92
+      _______________    _______________
+     |               |  |               |40.32
+     |       0       |  |       1       |
+     |               |  |               |
+r24  |_______________|  |_______________|0        r1        //updated: 15/02/2008
+      0           64.0  66.6        130.6                   //corrected: 05/08/2009 clm
 
 
-  y6  ----------  ----------   126.16
-      |        |  |        |
-      |    4   |  |    5   |
-  y5  ----------  ----------    85.84 
-
-  y4  ----------  ----------    83.24  
-      |        |  |        |
-      |    2   |  |    3   |             view from electronics side
-  y3  ----------  ----------    42.92
-          
-  y2  ----------  ----------    40.32
-      |        |  |        |
-      |    0   |  |    1   |
-  y1  ----------  ----------    0      
-      x1      x2  x3       x4
-
-      0    64.00   66.60    130.60 
-Preface: all geometrical information (like left-right sides) is reported as seen from electronic side.
 
 
 The DDL file starts with common header which size and structure is standartized and mandatory for all detectors. 
 
 
 The DDL file starts with common header which size and structure is standartized and mandatory for all detectors. 
@@ -97,9 +94,29 @@ HMPID raw word is 32 bits with the structure:
 void AliHMPIDDigit::Draw(Option_t*)
 {
 //  TMarker *pMark=new TMarker(LorsX(),LorsY(),25); pMark->SetMarkerColor(kGreen);pMark->Draw();
 void AliHMPIDDigit::Draw(Option_t*)
 {
 //  TMarker *pMark=new TMarker(LorsX(),LorsY(),25); pMark->SetMarkerColor(kGreen);pMark->Draw();
-  TBox *pad = new TBox(LorsX()-0.5*SizePadX(),LorsY()-0.5*SizePadY(),LorsX()+0.5*SizePadX(),LorsY()+0.5*SizePadY());
-  pad->SetFillStyle(0);pad->SetLineColor(kGreen);
-  pad->Draw();
+  TBox *pad = new
+TBox(LorsX()-0.5*AliHMPIDParam::SizePadX(),LorsY()-0.5*AliHMPIDParam::SizePadY(),LorsX()+0.5*AliHMPIDParam::SizePadX(),LorsY()+0.5*AliHMPIDParam::SizePadY());
+  TPolyLine *line=new TPolyLine(5);
+  line->SetPoint(0,LorsX()-0.5*AliHMPIDParam::SizePadX(),LorsY()-0.5*AliHMPIDParam::SizePadY());
+  line->SetPoint(1,LorsX()-0.5*AliHMPIDParam::SizePadX(),LorsY()+0.5*AliHMPIDParam::SizePadY());
+  line->SetPoint(2,LorsX()+0.5*AliHMPIDParam::SizePadX(),LorsY()+0.5*AliHMPIDParam::SizePadY());
+  line->SetPoint(3,LorsX()+0.5*AliHMPIDParam::SizePadX(),LorsY()-0.5*AliHMPIDParam::SizePadY());
+  line->SetPoint(4,LorsX()-0.5*AliHMPIDParam::SizePadX(),LorsY()-0.5*AliHMPIDParam::SizePadY());
+  Int_t slice=(Int_t)fQ/20;
+  switch(slice){
+    case 0: pad->SetFillColor(kBlue); break;
+    case 1: pad->SetFillColor(kBlue+4); break;
+    case 2: pad->SetFillColor(kCyan); break;
+    case 3: pad->SetFillColor(kCyan+4); break;
+    case 4: pad->SetFillColor(kGreen); break;
+    case 5: pad->SetFillColor(kGreen+4); break;
+    case 6: pad->SetFillColor(kYellow); break;
+    case 7: pad->SetFillColor(kYellow+4); break;
+    default: pad->SetFillColor(kRed);      break;
+  }
+   pad->SetUniqueID((Int_t)fQ);
+  pad->Draw();line->Draw();
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDDigit::Print(Option_t *opt)const
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDDigit::Print(Option_t *opt)const
@@ -110,38 +127,7 @@ void AliHMPIDDigit::Print(Option_t *opt)const
   UInt_t w32; Int_t ddl,r,d,a;
   Raw(w32,ddl,r,d,a);
   Printf("%sDIG:(ch=%1i,pc=%1i,x=%2i,y=%2i) (%7.3f,%7.3f) Q=%8.3f TID=(%5i,%5i,%5i) raw=0x%x (ddl=%2i,r=%2i,d=%2i,a=%2i) %s",
   UInt_t w32; Int_t ddl,r,d,a;
   Raw(w32,ddl,r,d,a);
   Printf("%sDIG:(ch=%1i,pc=%1i,x=%2i,y=%2i) (%7.3f,%7.3f) Q=%8.3f TID=(%5i,%5i,%5i) raw=0x%x (ddl=%2i,r=%2i,d=%2i,a=%2i) %s",
-          opt,  A2C(fPad),A2P(fPad),A2X(fPad),A2Y(fPad),LorsX(),LorsY(), Q(),  fTracks[0],fTracks[1],fTracks[2],w32,ddl,r,d,a, (IsOverTh(Q()))?"":"below thr");
+          opt,  AliHMPIDParam::A2C(fPad),AliHMPIDParam::A2P(fPad),AliHMPIDParam::A2X(fPad),AliHMPIDParam::A2Y(fPad),LorsX(),LorsY(), Q(),  
+         fTracks[0],fTracks[1],fTracks[2],w32,ddl,r,d,a, (AliHMPIDParam::IsOverTh(Q()))?"":"below thr");
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void AliHMPIDDigit::WriteRaw(TObjArray *pDigAll)
-{
-// Write a list of digits for a given chamber in raw data stream
-// Arguments: pDigAll- list of digits 
-//   Returns: none      
-  ofstream ddlL,ddlR;                               //output streams, 2 per chamber
-  Int_t    cntL=0,cntR=0;                           //data words counters for DDLs
-  AliRawDataHeader header; header.SetAttribute(0);  //empty DDL header
-
-  UInt_t w32=0; Int_t ddl,r,d,a;            //32 bits data word 
-  for(Int_t iCh=kMinCh;iCh<=kMaxCh;iCh++){//chambers loop
-    ddlL.open(AliDAQ::DdlFileName("HMPID",2*iCh)); 
-    ddlR.open(AliDAQ::DdlFileName("HMPID",2*iCh+1));      //open both DDL of this chamber in parallel
-    ddlL.write((char*)&header,sizeof(header));            //write dummy header as place holder, actual 
-    ddlR.write((char*)&header,sizeof(header));            //will be rewritten later when total size of DDL is known
-  
-    TClonesArray *pDigCh=(TClonesArray *)pDigAll->At(iCh); //list of digits for current chamber 
-    for(Int_t iDig=0;iDig<pDigCh->GetEntriesFast();iDig++){//digits loop
-      AliHMPIDDigit *pDig=(AliHMPIDDigit*)pDigCh->At(iDig);
-      pDig->Raw(w32,ddl,r,d,a);                             
-      if(ddl%2){
-        ddlL.write((char*)&w32,sizeof(w32));  cntL++;
-      }else{
-        ddlR.write((char*)&w32,sizeof(w32));  cntR++;
-      }
-    }//digits  loop
-
-    header.fSize=sizeof(header)+cntL*sizeof(w32); ddlL.seekp(0); ddlL.write((char*)&header,sizeof(header)); ddlL.close(); //rewrite header with size set to
-    header.fSize=sizeof(header)+cntR*sizeof(w32); ddlR.seekp(0); ddlR.write((char*)&header,sizeof(header)); ddlR.close(); //number of bytes and close file
-  }//chambers loop
-}//WriteRaw()
-//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++