some minor changes to adpat for the situation when no digits or clusters avalbale
authorkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Jan 2004 15:01:27 +0000 (15:01 +0000)
committerkir <kir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 26 Jan 2004 15:01:27 +0000 (15:01 +0000)
RICH/AliRICH.cxx
RICH/AliRICH.h
RICH/AliRICHClusterFinder.cxx
RICH/AliRICHDigitizer.cxx
RICH/AliRICHDisplFast.cxx
RICH/AliRICHDisplFast.h
RICH/AliRICHMap.cxx
RICH/AliRICHMap.h
RICH/CreateConfig.C

index fb940e9..5c75edb 100644 (file)
@@ -44,7 +44,7 @@ ClassImp(AliRICHdigit)
 void AliRICHdigit::Print(Option_t*)const
 {
   ::Info("digit","csxy=%6i, cfm=%9i, c=%2i, x=%3i, y=%3i, q=%8.3f, TID1=%5i, TID2=%5i, TID3=%5i",
-                  Id(),fCombiPid,fChamber,fPadX,fPadY,fQdc,fTracks[0],fTracks[1],fTracks[2]);
+                  Id(),fChFbMip,fChamber,fPadX,fPadY,fQdc,fTracks[0],fTracks[1],fTracks[2]);
 }
 //__________________________________________________________________________________________________
 ClassImp(AliRICHcluster)
@@ -133,15 +133,15 @@ void AliRICH::Hits2SDigits()
       GetLoader()->TreeH()->GetEntry(iPrimN);
       for(Int_t iHitN=0;iHitN<Hits()->GetEntries();iHitN++){//hits loop 
         AliRICHhit *pHit=(AliRICHhit*)Hits()->At(iHitN);                
-        TVector2 x2 = Param()->ShiftToWirePos(C(pHit->C())->Glob2Loc(pHit->OutX3()));                
-        Int_t iTotQdc=Param()->TotQdc(x2,pHit->Eloss());
+        TVector2 x2 = P()->ShiftToWirePos(C(pHit->C())->Glob2Loc(pHit->OutX3()));                
+        Int_t iTotQdc=P()->TotQdc(x2,pHit->Eloss());
         if(iTotQdc==0) continue;
         Int_t iPadXmin,iPadXmax,iPadYmin,iPadYmax;
-        Param()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax);//determine affected pads
+        P()->Loc2Area(x2,iPadXmin,iPadYmin,iPadXmax,iPadYmax);//determine affected pads
         if(GetDebug()) Info("Hits2SDigits","left-down=(%i,%i) right-up=(%i,%i)",iPadXmin,iPadYmin,iPadXmax,iPadYmax);
         for(Int_t iPadY=iPadYmin;iPadY<=iPadYmax;iPadY++)//affected pads loop
           for(Int_t iPadX=iPadXmin;iPadX<=iPadXmax;iPadX++){
-            Double_t padQdc=iTotQdc*Param()->FracQdc(x2,iPadX,iPadY);
+            Double_t padQdc=iTotQdc*P()->FracQdc(x2,iPadX,iPadY);
             if(padQdc>0.1) AddSDigit(pHit->C(),iPadX,iPadY,padQdc,
               GetLoader()->GetRunLoader()->Stack()->Particle(pHit->GetTrack())->GetPdgCode(),pHit->GetTrack());
           }//affected pads loop 
@@ -166,8 +166,8 @@ void AliRICH::BuildGeometry()
   
   new TBRIK("S_RICH","S_RICH","void",71.09999,11.5,73.15);
 
-  Float_t wid=Param()->SectorSizeX();
-  Float_t len=Param()->SectorSizeY();
+  Float_t wid=P()->SectorSizeX();
+  Float_t len=P()->SectorSizeY();
   new TBRIK("PHOTO","PHOTO","void",wid/2,0.1,len/2);
   
   for(int i=1;i<=kNCH;i++){
@@ -175,22 +175,22 @@ void AliRICH::BuildGeometry()
     node = new TNode(Form("RICH%i",i),Form("RICH%i",i),"S_RICH",C(i)->X(),C(i)->Y(),C(i)->Z(),C(i)->RotMatrixName());
     node->SetLineColor(kRed);
     node->cd();
-    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+Param()->DeadZone(),5,len/2+Param()->DeadZone()/2,"");
+    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+P()->DeadZone(),5,len/2+P()->DeadZone()/2,"");
     subnode->SetLineColor(kGreen);
     fNodes->Add(subnode);
-    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,len/2+Param()->DeadZone()/2,"");
+    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,len/2+P()->DeadZone()/2,"");
     subnode->SetLineColor(kGreen);
     fNodes->Add(subnode);
-    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-Param()->DeadZone(),5,len/2+Param()->DeadZone()/2,"");
+    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-P()->DeadZone(),5,len/2+P()->DeadZone()/2,"");
     subnode->SetLineColor(kGreen);
     fNodes->Add(subnode);
-    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+Param()->DeadZone(),5,-len/2-Param()->DeadZone()/2,"");
+    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",wid+P()->DeadZone(),5,-len/2-P()->DeadZone()/2,"");
     subnode->SetLineColor(kGreen);
     fNodes->Add(subnode);
-    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-len/2 -Param()->DeadZone()/2,"");
+    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",0,5,-len/2 -P()->DeadZone()/2,"");
     subnode->SetLineColor(kGreen);
     fNodes->Add(subnode);
-    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-Param()->DeadZone(),5,-len/2 - Param()->DeadZone()/2,"");
+    subnode = new TNode("PHOTO1","PHOTO1","PHOTO",-wid-P()->DeadZone(),5,-len/2 - P()->DeadZone()/2,"");
     subnode->SetLineColor(kGreen);
     fNodes->Add(subnode);
     fNodes->Add(node);
@@ -433,7 +433,7 @@ void AliRICH::Print(Option_t *option)const
 {
 //Debug printout
   TObject::Print(option);
-  Param()->Dump();
+  P()->Dump();
   fChambers->Print(option);  
 }//void AliRICH::Print(Option_t *option)const
 //__________________________________________________________________________________________________
@@ -444,8 +444,8 @@ void AliRICH::CreateGeometry()
 //Opaque quartz thickness
   Float_t oquaThickness = .5;
 //CsI dimensions
-  Float_t pcX=Param()->PcSizeX();
-  Float_t pcY=Param()->PcSizeY();
+  Float_t pcX=P()->PcSizeX();
+  Float_t pcY=P()->PcSizeY();
   
   Int_t *idtmed = fIdtmed->GetArray()-999;
     
@@ -468,34 +468,34 @@ void AliRICH::CreateGeometry()
   par[0]=66.3;par[1]=0.025;par[2]=68.35;           gMC->Gsvolu("ALUM", "BOX ", idtmed[1009], par, 3);
   //par[0] = 66.5; par[1] = .025; par[2] = 63.1;
 //Quartz 
-  par[0]=Param()->QuartzWidth()/2;par[1]=Param()->QuartzThickness()/2;par[2]=Param()->QuartzLength()/2;
+  par[0]=P()->QuartzWidth()/2;par[1]=P()->QuartzThickness()/2;par[2]=P()->QuartzLength()/2;
   gMC->Gsvolu("QUAR", "BOX ", idtmed[1002], par, 3);
 //Spacers (cylinders) 
-  par[0]=0.;par[1]=.5;par[2]=Param()->FreonThickness()/2;  gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);    
+  par[0]=0.;par[1]=.5;par[2]=P()->FreonThickness()/2;  gMC->Gsvolu("SPAC", "TUBE", idtmed[1002], par, 3);    
 //Feet (freon slabs supports)
   par[0] = .7;  par[1] = .3;  par[2] = 1.9;        gMC->Gsvolu("FOOT", "BOX", idtmed[1009], par, 3);
 //Opaque quartz 
-  par[0]=Param()->QuartzWidth()/2;par[1]= .2;par[2]=Param()->QuartzLength()/2;
+  par[0]=P()->QuartzWidth()/2;par[1]= .2;par[2]=P()->QuartzLength()/2;
   gMC->Gsvolu("OQUA", "BOX ", idtmed[1007], par, 3);
 //Frame of opaque quartz
-  par[0]=Param()->OuterFreonWidth()/2;par[1]=Param()->FreonThickness()/2;par[2]=Param()->OuterFreonLength()/2; 
+  par[0]=P()->OuterFreonWidth()/2;par[1]=P()->FreonThickness()/2;par[2]=P()->OuterFreonLength()/2; 
   gMC->Gsvolu("OQF1", "BOX ", idtmed[1007], par, 3);
-  par[0]=Param()->InnerFreonWidth()/2;par[1]=Param()->FreonThickness()/2;par[2]=Param()->InnerFreonLength()/2; 
+  par[0]=P()->InnerFreonWidth()/2;par[1]=P()->FreonThickness()/2;par[2]=P()->InnerFreonLength()/2; 
   gMC->Gsvolu("OQF2", "BOX ", idtmed[1007], par, 3);
 //Freon 
-  par[0]=Param()->OuterFreonWidth()/2 - oquaThickness;
-  par[1]=Param()->FreonThickness()/2;
-  par[2]=Param()->OuterFreonLength()/2 - 2*oquaThickness; 
+  par[0]=P()->OuterFreonWidth()/2 - oquaThickness;
+  par[1]=P()->FreonThickness()/2;
+  par[2]=P()->OuterFreonLength()/2 - 2*oquaThickness; 
   gMC->Gsvolu("FRE1", "BOX ", idtmed[1003], par, 3);
 
-  par[0]=Param()->InnerFreonWidth()/2 - oquaThickness;
-  par[1]=Param()->FreonThickness()/2;
-  par[2]=Param()->InnerFreonLength()/2 - 2*oquaThickness; 
+  par[0]=P()->InnerFreonWidth()/2 - oquaThickness;
+  par[1]=P()->FreonThickness()/2;
+  par[2]=P()->InnerFreonLength()/2 - 2*oquaThickness; 
   gMC->Gsvolu("FRE2", "BOX ", idtmed[1003], par, 3);    
 //Methane 
-  par[0]=pcX/2;par[1]=Param()->GapThickness()/2;par[2]=pcY/2;         gMC->Gsvolu("META","BOX ",idtmed[1004], par, 3);
+  par[0]=pcX/2;par[1]=P()->GapThickness()/2;par[2]=pcY/2;         gMC->Gsvolu("META","BOX ",idtmed[1004], par, 3);
 //Methane gap 
-  par[0]=pcX/2;par[1]=Param()->ProximityGap()/2;par[2]=pcY/2;gMC->Gsvolu("GAP ","BOX ",(*fIdtmed)[kGAP],par,3);
+  par[0]=pcX/2;par[1]=P()->ProximityGap()/2;par[2]=pcY/2;gMC->Gsvolu("GAP ","BOX ",(*fIdtmed)[kGAP],par,3);
 //CsI PC
   par[0]=pcX/2;par[1]=.25;par[2]=pcY/2;  gMC->Gsvolu("CSI ", "BOX ", (*fIdtmed)[kCSI], par, 3);
 //Anode grid 
@@ -511,19 +511,19 @@ void AliRICH::CreateGeometry()
 
 //Aluminium supports for methane and CsI
 //Short bar
-  par[0]=pcX/2;par[1]=Param()->GapThickness()/2 + .25; par[2] = (68.35 - pcY/2)/2;
+  par[0]=pcX/2;par[1]=P()->GapThickness()/2 + .25; par[2] = (68.35 - pcY/2)/2;
   gMC->Gsvolu("SMSH", "BOX", idtmed[1009], par, 3);
 //Long bar
-  par[0]=(66.3 - pcX/2)/2;par[1]=Param()->GapThickness()/2+.25;par[2]=pcY/2+68.35-pcY/2;
+  par[0]=(66.3 - pcX/2)/2;par[1]=P()->GapThickness()/2+.25;par[2]=pcY/2+68.35-pcY/2;
   gMC->Gsvolu("SMLG", "BOX", idtmed[1009], par, 3);
     
 //Aluminium supports for freon
 //Short bar
-  par[0] = Param()->QuartzWidth()/2; par[1] = .3; par[2] = (68.35 - Param()->QuartzLength()/2)/2;
+  par[0] = P()->QuartzWidth()/2; par[1] = .3; par[2] = (68.35 - P()->QuartzLength()/2)/2;
   gMC->Gsvolu("SFSH", "BOX", idtmed[1009], par, 3);    
 //Long bar
-  par[0] = (66.3 - Param()->QuartzWidth()/2)/2; par[1] = .3;
-  par[2] = Param()->QuartzLength()/2 + 68.35 - Param()->QuartzLength()/2;
+  par[0] = (66.3 - P()->QuartzWidth()/2)/2; par[1] = .3;
+  par[2] = P()->QuartzLength()/2 + 68.35 - P()->QuartzLength()/2;
   gMC->Gsvolu("SFLG", "BOX", idtmed[1009], par, 3);    
 //PCB backplane
   par[0] = pcX/2;par[1] = .25; par[2] = pcY/4 -.5025;  gMC->Gsvolu("PCB ", "BOX", idtmed[1011], par, 3);
@@ -554,33 +554,33 @@ void AliRICH::CreateGeometry()
   gMC->Gspos("BKHL", 8, "BACK", -.8 - 11.4 - 1.6 - 9.05, 0., -.6 - 8.925 - 1.2 - 4.4625, 0, "ONLY");
 //Place material inside RICH 
   gMC->Gspos("SRIC", 1, "RICH", 0.,0., 0., 0, "ONLY");
-  gMC->Gspos("AIR2", 1, "RICH", 66.3 + 1.2505, 1.276-Param()->GapThickness()/2-Param()->QuartzThickness()-Param()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
-  gMC->Gspos("AIR2", 2, "RICH", -66.3 - 1.2505,1.276-Param()->GapThickness()/2-Param()->QuartzThickness()-Param()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
-  gMC->Gspos("AIR3", 1, "RICH", 0., 1.276-Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, -68.35 - 1.25, 0, "ONLY");
-  gMC->Gspos("AIR3", 2, "RICH", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35,  68.35 + 1.25, 0, "ONLY");
-  gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
-  gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- Param()->GapThickness()/2  - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
-  gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
-  gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
-  gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
-  gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
-  gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
-  gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
-  gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
-  gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
-  gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
-  gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()- .2, 0., 0, "ONLY");
+  gMC->Gspos("AIR2", 1, "RICH", 66.3 + 1.2505, 1.276-P()->GapThickness()/2-P()->QuartzThickness()-P()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
+  gMC->Gspos("AIR2", 2, "RICH", -66.3 - 1.2505,1.276-P()->GapThickness()/2-P()->QuartzThickness()-P()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, 0., 0, "ONLY");
+  gMC->Gspos("AIR3", 1, "RICH", 0., 1.276-P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35, -68.35 - 1.25, 0, "ONLY");
+  gMC->Gspos("AIR3", 2, "RICH", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .6 - .05 - .376 -.5 - 3.35,  68.35 + 1.25, 0, "ONLY");
+  gMC->Gspos("ALUM", 1, "SRIC", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .6 - .05 - .376 -.025, 0., 0, "ONLY");
+  gMC->Gspos("HONE", 1, "SRIC", 0., 1.276- P()->GapThickness()/2  - P()->QuartzThickness() - P()->FreonThickness()- .4 - .6 - .05 - .188, 0., 0, "ONLY");
+  gMC->Gspos("ALUM", 2, "SRIC", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .6 - .025, 0., 0, "ONLY");
+  gMC->Gspos("FOOT", 1, "SRIC", 64.95, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
+  gMC->Gspos("FOOT", 2, "SRIC", 21.65, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3 , 36.9, 0, "ONLY");
+  gMC->Gspos("FOOT", 3, "SRIC", -21.65, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
+  gMC->Gspos("FOOT", 4, "SRIC", -64.95, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, 36.9, 0, "ONLY");
+  gMC->Gspos("FOOT", 5, "SRIC", 64.95, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
+  gMC->Gspos("FOOT", 6, "SRIC", 21.65, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
+  gMC->Gspos("FOOT", 7, "SRIC", -21.65, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
+  gMC->Gspos("FOOT", 8, "SRIC", -64.95, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .4 - .3, -36.9, 0, "ONLY");
+  gMC->Gspos("OQUA", 1, "SRIC", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()- .2, 0., 0, "ONLY");
 // Methane supports
   gMC->Gspos("SMLG", 1, "SRIC", pcX/2 + (66.3 - pcX/2)/2, 1.276 + .25, 0., 0, "ONLY");
   gMC->Gspos("SMLG", 2, "SRIC", - pcX/2 - (66.3 - pcX/2)/2, 1.276 + .25, 0., 0, "ONLY");
   gMC->Gspos("SMSH", 1, "SRIC", 0., 1.276 + .25, pcY/2 + (68.35 - pcY/2)/2, 0, "ONLY");
   gMC->Gspos("SMSH", 2, "SRIC", 0., 1.276 + .25, - pcY/2 - (68.35 - pcY/2)/2, 0, "ONLY");
 //Freon supports
-  Float_t suppY = 1.276 - Param()->GapThickness()/2- Param()->QuartzThickness() -Param()->FreonThickness() - .2 + .3; //y position of freon supports
-  gMC->Gspos("SFLG", 1, "SRIC", Param()->QuartzWidth()/2 + (66.3 - Param()->QuartzWidth()/2)/2, suppY, 0., 0, "ONLY");
-  gMC->Gspos("SFLG", 2, "SRIC", - Param()->QuartzWidth()/2 - (66.3 - Param()->QuartzWidth()/2)/2, suppY, 0., 0, "ONLY");
-  gMC->Gspos("SFSH", 1, "SRIC", 0., suppY, Param()->QuartzLength()/2 + (68.35 - Param()->QuartzLength()/2)/2, 0, "ONLY");
-  gMC->Gspos("SFSH", 2, "SRIC", 0., suppY, - Param()->QuartzLength()/2 - (68.35 - Param()->QuartzLength()/2)/2, 0, "ONLY");
+  Float_t suppY = 1.276 - P()->GapThickness()/2- P()->QuartzThickness() -P()->FreonThickness() - .2 + .3; //y position of freon supports
+  gMC->Gspos("SFLG", 1, "SRIC", P()->QuartzWidth()/2 + (66.3 - P()->QuartzWidth()/2)/2, suppY, 0., 0, "ONLY");
+  gMC->Gspos("SFLG", 2, "SRIC", - P()->QuartzWidth()/2 - (66.3 - P()->QuartzWidth()/2)/2, suppY, 0., 0, "ONLY");
+  gMC->Gspos("SFSH", 1, "SRIC", 0., suppY, P()->QuartzLength()/2 + (68.35 - P()->QuartzLength()/2)/2, 0, "ONLY");
+  gMC->Gspos("SFSH", 2, "SRIC", 0., suppY, - P()->QuartzLength()/2 - (68.35 - P()->QuartzLength()/2)/2, 0, "ONLY");
   AliMatrix(idrotm[1019], 0., 0., 90., 0., 90., 90.);
 //Place spacers
   Int_t nspacers = 30;
@@ -610,27 +610,27 @@ void AliRICH::CreateGeometry()
   }
   gMC->Gspos("FRE1", 1, "OQF1", 0., 0., 0., 0, "ONLY");
   gMC->Gspos("FRE2", 1, "OQF2", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("OQF1", 1, "SRIC", Param()->OuterFreonWidth()/2 + Param()->InnerFreonWidth()/2 + 2, 1.276 - Param()->GapThickness()/2- Param()->QuartzThickness() -Param()->FreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3)
-  gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()/2, 0., 0, "ONLY");          //Original settings 
-  gMC->Gspos("OQF1", 3, "SRIC", - (Param()->OuterFreonWidth()/2 + Param()->InnerFreonWidth()/2) - 2, 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness() - Param()->FreonThickness()/2, 0., 0, "ONLY");       //Original settings (-31.3)
-  gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - Param()->GapThickness()/2 - Param()->QuartzThickness()/2, 0., 0, "ONLY");
-  gMC->Gspos("GAP ", 1, "META", 0., Param()->GapThickness()/2 - Param()->ProximityGap()/2 - 0.0001, 0., 0, "ONLY");
+  gMC->Gspos("OQF1", 1, "SRIC", P()->OuterFreonWidth()/2 + P()->InnerFreonWidth()/2 + 2, 1.276 - P()->GapThickness()/2- P()->QuartzThickness() -P()->FreonThickness()/2, 0., 0, "ONLY"); //Original settings (31.3)
+  gMC->Gspos("OQF2", 2, "SRIC", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()/2, 0., 0, "ONLY");          //Original settings 
+  gMC->Gspos("OQF1", 3, "SRIC", - (P()->OuterFreonWidth()/2 + P()->InnerFreonWidth()/2) - 2, 1.276 - P()->GapThickness()/2 - P()->QuartzThickness() - P()->FreonThickness()/2, 0., 0, "ONLY");       //Original settings (-31.3)
+  gMC->Gspos("QUAR", 1, "SRIC", 0., 1.276 - P()->GapThickness()/2 - P()->QuartzThickness()/2, 0., 0, "ONLY");
+  gMC->Gspos("GAP ", 1, "META", 0., P()->GapThickness()/2 - P()->ProximityGap()/2 - 0.0001, 0., 0, "ONLY");
   gMC->Gspos("META", 1, "SRIC", 0., 1.276, 0., 0, "ONLY");
-  gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + Param()->GapThickness()/2 + .25, 0., 0, "ONLY");
+  gMC->Gspos("CSI ", 1, "SRIC", 0., 1.276 + P()->GapThickness()/2 + .25, 0., 0, "ONLY");
 //Wire support placing
-  gMC->Gspos("WSG2", 1, "GAP ", 0., Param()->ProximityGap()/2 - .1, 0., 0, "ONLY");
+  gMC->Gspos("WSG2", 1, "GAP ", 0., P()->ProximityGap()/2 - .1, 0., 0, "ONLY");
   gMC->Gspos("WSG1", 1, "CSI ", 0., 0., 0., 0, "ONLY");
-  gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + Param()->GapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
+  gMC->Gspos("WSMe", 1, "SRIC ", 0., 1.276 + P()->GapThickness()/2 + .5 + 1.05, 0., 0, "ONLY");
 //Backplane placing
-  gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
-  gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
-  gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
-  gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
-  gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
-  gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + Param()->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
+  gMC->Gspos("BACK", 1, "SRIC ", -33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2, 43.3, 0, "ONLY");
+  gMC->Gspos("BACK", 2, "SRIC ", 33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2 , 43.3, 0, "ONLY");
+  gMC->Gspos("BACK", 3, "SRIC ", -33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
+  gMC->Gspos("BACK", 4, "SRIC ", 33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2, 0., 0, "ONLY");
+  gMC->Gspos("BACK", 5, "SRIC ", 33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
+  gMC->Gspos("BACK", 6, "SRIC ", -33.15, 1.276 + P()->GapThickness()/2 + .5 + 2.1 + 2, -43.3, 0, "ONLY");
 //PCB placing
-  gMC->Gspos("PCB ", 1, "SRIC ", 0.,  1.276 + Param()->GapThickness()/2 + .5 + 1.05, pcX/4 + .5025 + 2.5, 0, "ONLY");
-  gMC->Gspos("PCB ", 2, "SRIC ", 0.,  1.276 + Param()->GapThickness()/2 + .5 + 1.05, -pcX/4 - .5025 - 2.5, 0, "ONLY");
+  gMC->Gspos("PCB ", 1, "SRIC ", 0.,  1.276 + P()->GapThickness()/2 + .5 + 1.05, pcX/4 + .5025 + 2.5, 0, "ONLY");
+  gMC->Gspos("PCB ", 2, "SRIC ", 0.,  1.276 + P()->GapThickness()/2 + .5 + 1.05, -pcX/4 - .5025 - 2.5, 0, "ONLY");
 
 //place chambers into mother volume ALIC
   for(int i=1;i<=kNCH;i++){
@@ -650,7 +650,7 @@ void AliRICH::CreateChambers()
   if(GetDebug())Info("CreateChambers","Creating RICH chambers.");
   fChambers=new TObjArray(kNCH);
   fChambers->SetOwner();
-  for(int i=0;i<kNCH;i++)  fChambers->AddAt(new AliRICHChamber(i+1,Param()),i);  
+  for(int i=0;i<kNCH;i++)  fChambers->AddAt(new AliRICHChamber(i+1,P()),i);  
 }//void AliRICH::CreateChambers()
 //__________________________________________________________________________________________________
 void AliRICH::GenerateFeedbacks(Int_t iChamber,Float_t eloss)
@@ -661,8 +661,8 @@ void AliRICH::GenerateFeedbacks(Int_t iChamber,Float_t eloss)
   TLorentzVector x4;
   gMC->TrackPosition(x4);  
   TVector2 x2=C(iChamber)->Glob2Loc(x4);
-  Int_t sector=Param()->Sector(x2);  if(sector==kBad) return; //hit in dead zone nothing to produce
-  Int_t iTotQdc=Param()->TotQdc(x2,eloss);
+  Int_t sector=P()->Sector(x2);  if(sector==kBad) return; //hit in dead zone nothing to produce
+  Int_t iTotQdc=P()->TotQdc(x2,eloss);
   Int_t iNphotons=gMC->GetRandom()->Poisson(P()->AlphaFeedback(sector)*iTotQdc);    
   if(GetDebug())Info("GenerateFeedbacks","N photons=%i",iNphotons);
   Int_t j;
index 6880566..1966a6e 100644 (file)
@@ -6,98 +6,65 @@
 
 #include <TObjArray.h>
 #include <TClonesArray.h>
-#include <TLorentzVector.h>
+#include <TVector3.h>
+#include <Riostream.h>
 #include <AliDetector.h>
 #include <AliHit.h>
 #include <AliDigit.h>
 #include "AliRICHDigitizer.h"
 #include "AliRICHParam.h"
-#include <Riostream.h>
 
 //__________________AliRICHhit______________________________________________________________________
 class AliRICHhit : public AliHit
 {
 public:
-  AliRICHhit():AliHit() {fChamber=fPid=kBad;  fEloss=kBad;  fInX3.SetXYZ(0,0,0);fOutX3.SetXYZ(0,0,0);
-                         fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=fMomFreoX=fMomFreoY=fMomFreoZ=kBad;}
-  AliRICHhit(Int_t c,Int_t tid,TVector3 in,TVector3 out,Double_t e):AliHit(0,tid) {fInX3=in; fOutX3=out; fChamber=c; fEloss=e;
-                                                                                       fX=out.X();fY=out.Y();fZ=out.Z(); 
-                                            fPid=kBad;fMomX=fMomY=fMomZ=fNPads=fCerenkovAngle=fMomFreoX=fMomFreoY=fMomFreoZ=kBad;}
-  inline   AliRICHhit(Int_t fIshunt, Int_t track, Int_t *vol, Float_t *hits);                  //old version 3 ????? 
-  virtual ~AliRICHhit()         {;}
+           AliRICHhit():AliHit()          {fChamber=kBad;  fEloss=kBad;  fInX3.SetXYZ(0,0,0);fOutX3.SetXYZ(0,0,0);}
+           AliRICHhit(Int_t c,Int_t tid,TVector3 in,TVector3 out,Double_t e):AliHit(0,tid)
+                                          {fChamber=c;fInX3=in; fOutX3=out;fEloss=e; fX=out.X();fY=out.Y();fZ=out.Z();}
+  virtual ~AliRICHhit()                   {;}
 
-  Int_t   C()                   const{return fChamber;}
-  Int_t   Chamber()             const{return fChamber;}
-  Int_t   Pid()                 const{return fPid;}    
-  Int_t   Particle()            const{return fPid;}
-  Float_t Eloss()               const{return fEloss;}
-  Float_t MomX()                const{return fMomX;}
-  Float_t MomY()                const{return fMomY;}
-  Float_t MomZ()                const{return fMomZ;}
-  Float_t CerenkovAngle()       const{return fCerenkovAngle;}
-  Float_t MomFreoX()            const{return fMomFreoX;}
-  Float_t MomFreoY()            const{return fMomFreoY;}
-  Float_t MomFreoZ()            const{return fMomFreoZ;}
-  TVector3 InX3()               const{return fInX3;}
-  TVector3 OutX3()              const{return fOutX3;}
-  Double_t Length()             const{return (fOutX3-fInX3).Mag();}
-  void    Print(Option_t *option="")const;      //virtual
+  Int_t    C()                       const{return fChamber;}              //chamber number 
+  Int_t    Chamber()                 const{return fChamber;}              //chamber number 
+  Float_t  Eloss()                   const{return fEloss;}                //energy lost by track inside amplification gap  
+  TVector3 InX3()                    const{return fInX3;}                 //track position at the faceplane of the gap 
+  TVector3 OutX3()                   const{return fOutX3;}                //track position at the backplane of the gap 
+  Double_t Length()                  const{return (fOutX3-fInX3).Mag();}  //track length inside the amplification gap
+  void     Print(Option_t *option="")const;                               //virtual
 protected:
   Int_t     fChamber;                      //chamber number
-  Int_t     fPid;                          //particle code
-  Double_t  fEloss;                        //ionisation energy loss in GAP
-  Float_t   fMomX,fMomY,fMomZ;             //momentum at photochatode entry point
-  Float_t   fNPads;                        //Pads hit
-  Float_t   fCerenkovAngle;                //Dummy cerenkov angle
-  Float_t   fMomFreoX,fMomFreoY,fMomFreoZ; //momentum at freon entry point
+  Double_t  fEloss;                        //ionisation energy lost in GAP
   TVector3  fInX3;                         //position at the entrance of the GAP   
-  TVector3  fOutX3;                        //position at exit of the GAP
+  TVector3  fOutX3;                        //position at the exit of the GAP
   ClassDef(AliRICHhit,2)                   //RICH hit class
 };//class AliRICHhit
-//__________________________________________________________________________________________________
-AliRICHhit::AliRICHhit(Int_t shunt, Int_t track, Int_t *vol, Float_t *hit)
-           :AliHit(shunt, track)
-{
-// old ctor to be deleted
-  fChamber=vol[0];
-  fPid=(Int_t)hit[0];
-  fX=hit[1];fY=hit[2];fZ=hit[3];
-  fEloss=hit[7];
-  fMomX=hit[14];fMomY=hit[15];fMomZ=hit[16];
-  fCerenkovAngle=hit[18];
-  fMomFreoX=hit[19];fMomFreoY=hit[20];fMomFreoZ=hit[21];
-}
 
 //__________________AliRICHdigit____________________________________________________________________
 class AliRICHdigit :public AliDigit
 {
 public:
-           AliRICHdigit() {fCombiPid=fChamber=fPadX=fPadY=fTracks[0]=fTracks[1]=fTracks[2]=kBad;fQdc=kBad;}
-           AliRICHdigit(Int_t c,Int_t x,Int_t y,Double_t q,Int_t cpid,Int_t tid0,Int_t tid1,Int_t tid2)
-           {fPadX=x;fPadY=y;fQdc=q;fChamber=10*c+AliRICHParam::Sector(x,y);fCombiPid=cpid;fTracks[0]=tid0;fTracks[1]=tid1;fTracks[2]=tid2;}        
+  AliRICHdigit() {fChFbMip=fChamber=fPadX=fPadY=fTracks[0]=fTracks[1]=fTracks[2]=kBad;fQdc=kBad;}
+  AliRICHdigit(Int_t c,Int_t x,Int_t y,Double_t q,Int_t cpid,Int_t tid0,Int_t tid1,Int_t tid2)  
+                 {fPadX=x;fPadY=y;fQdc=q;fChamber=10*c+AliRICHParam::Sector(x,y);fChFbMip=cpid;fTracks[0]=tid0;fTracks[1]=tid1;fTracks[2]=tid2;}
   virtual ~AliRICHdigit() {;}  
-  Int_t    Compare(const TObject *pObj) const                                         //virtual
-           {if(Id()==((AliRICHdigit*)pObj)->Id()) return 0; else if(Id()>((AliRICHdigit*)pObj)->Id()) return 1;  else return -1;} 
-           
-           Bool_t   IsSortable()                                  const{return kTRUE;}//virtual
-           Int_t    CombiPid()                                    const{return fCombiPid;}
-           Int_t    C()                                           const{return fChamber/10;}
-           Int_t    S()                                           const{return fChamber-(fChamber/10)*10;} 
-           Int_t    Chamber()                                     const{return C();}
-           Int_t    Sector()                                      const{return S();}
-           Int_t    X()                                           const{return fPadX;}
-           Int_t    Y()                                           const{return fPadY;}
-           Int_t    Id()                                          const{return fChamber*10000000+fPadX*1000+fPadY;}
-           Double_t Q()                                           const{return fQdc;}
-           Int_t    Tid(Int_t i)                                  const{return fTracks[i];}
-           void  Print(Option_t *option="")const;                 //virtual
+  Int_t    Compare(const TObject *pObj) const
+                 {if(Id()==((AliRICHdigit*)pObj)->Id())return 0;else if(Id()>((AliRICHdigit*)pObj)->Id())return 1;else return -1;}  //virtual      
+  Bool_t   IsSortable()                 const{return kTRUE;}                              //virtual
+  void     Print(Option_t *option="")   const;                                            //virtual
+  Int_t    ChFbMi()                     const{return fChFbMip;}                           //particle mixture for this digit
+  Int_t    C()                          const{return fChamber/10;}                        //chamber number
+  Int_t    S()                          const{return fChamber-(fChamber/10)*10;}          //sector number
+  Int_t    X()                          const{return fPadX;}                              //x position of the pad
+  Int_t    Y()                          const{return fPadY;}                              //y postion of the pad
+  Int_t    Id()                         const{return fChamber*10000000+fPadX*1000+fPadY;} //absolute id of this pad
+  Double_t Q()                          const{return fQdc;}                               //charge in terms of ADC channels
+  Int_t    Tid(Int_t i)                 const{return fTracks[i];}                         //track reference produced this digit
 protected:
-  Int_t    fCombiPid; //1000000*Ncerenkovs+1000*Nfeedbacks+Nmips  
+  Int_t    fChFbMip;  //1000000*Ncerenkovs+1000*Nfeedbacks+Nmips  
   Int_t    fChamber;  //10*chamber number+ sector number 
   Int_t    fPadX;     //pad number along X
   Int_t    fPadY;     //pad number along Y
   Double_t fQdc;      //QDC value, fractions are permitted for summable procedure  
-  ClassDef(AliRICHdigit,2) //RICH digit class       
+  ClassDef(AliRICHdigit,3) //RICH digit class       
 };//class AliRICHdigit
 
 //__________________AliRICHcluster__________________________________________________________________
@@ -115,8 +82,6 @@ public:
          Int_t      C()                                         const{return fChamber/10;}                 //
          Int_t      S()                                         const{return fChamber-(fChamber/10)*10;}   //
          Int_t      Fchamber()                                  const{return fChamber;}                    //
-         Int_t      Chamber()                                   const{return C();}                         //
-         Int_t      Sector()                                    const{return S();}                         //
          Int_t      Q()                                         const{return fQdc;}                        // 
          Double_t   X()                                         const{return fX;}                          //
          Double_t   Y()                                         const{return fY;}                          // 
@@ -175,7 +140,8 @@ void AliRICHcluster::CoG(Int_t nLocals)
    fSize+=nLocals;
    fStatus=kRaw;
 }//CoG()
-//__________________________________________________________________________________________________
+
+
 class AliRICHreco: public TObject
 {
 public:
@@ -194,6 +160,7 @@ protected:
    ClassDef(AliRICHreco,1)  //RICH reco class
 
 };//class AliRICHreco
+
 //__________________AliRICH_________________________________________________________________________
 class AliRICHParam;
 class AliRICHChamber;
@@ -203,59 +170,61 @@ class AliRICH : public AliDetector
 public:
             AliRICH();                                            
             AliRICH(const char *name, const char *title);
-            AliRICH(const AliRICH& RICH):AliDetector(RICH) {;}   
+            AliRICH(const AliRICH& RICH):AliDetector(RICH) {;}  //copy ctor 
   virtual  ~AliRICH();                                            
           
   AliRICH&  operator=(const AliRICH&)                 {return *this;}
-  virtual Int_t   IsVersion()                                            const =0;            
+//framework part  
+  virtual Int_t   IsVersion()                                            const =0;                                //virtual         
+  virtual void    StepManager()                                                =0;                                //virtual
           void    Hits2SDigits();                                                                                 //virtual
   AliDigitizer*   CreateDigitizer(AliRunDigitizer* man) const {return new AliRICHDigitizer(man);}                 //virtual
-  
-  inline  void    CreateHits();    
-  inline  void    CreateSDigits();  
-  inline  void    CreateDigits();  
-  inline  void    CreateClusters();  
-  inline  void    CreateRecos();  
-  void AddHit(Int_t chamber,Int_t tid,TVector3 iX3,TVector3 oX3,Double_t eloss=0)
-             {TClonesArray &tmp=*fHits;new(tmp[fNhits++])AliRICHhit(chamber,tid,iX3,oX3,eloss);} 
-  inline void AddSDigit(Int_t c,Int_t x,Int_t y,Double_t q,Int_t pid,Int_t tid); 
-  void AddDigit(int c,int x,int y,int q,int cpid,int *tid){TClonesArray &tmp=*((TClonesArray*)fDigitsNew->At(c-1));new(tmp[fNdigitsNew[c-1]++])AliRICHdigit(c,x,y,q,cpid,tid[0],tid[1],tid[2]);}  
-  void AddCluster(AliRICHcluster &cl)                     {Int_t c=cl.C()-1;cout<<c<<endl;TClonesArray &tmp=*((TClonesArray*)fClusters->At(c));new(tmp[fNclusters[c]++])AliRICHcluster(cl);}
-  void AddReco(Int_t tid,Double_t thetaCherenkov,Int_t nPhotons) {TClonesArray &tmp=*(TClonesArray*)fRecos;new(tmp[fNrecos++])AliRICHreco(tid,thetaCherenkov,nPhotons);}  
-//  void ResetHits()     {AliDetector::ResetHits();}  //virtual  
-  void ResetSDigits()  {fNsdigits=0;  if(fSdigits)  fSdigits ->Clear();}                                 
-  void ResetDigits()   {if(fDigitsNew)for(int i=0;i<kNCH;i++){fDigitsNew->At(i)->Clear();fNdigitsNew[i]=0;}}
-  void ResetClusters() {if(fClusters) for(int i=0;i<kNCH;i++){fClusters ->At(i)->Clear();fNclusters[i]=0;}}
-  void ResetRecos()    {if(fRecos) fRecos->Clear();fNrecos=0;}
-                  //Hits provided by AliDetector
+          void    Print(Option_t *option)const;                                                                   //virtual
+          void    SetTreeAddress();                                                                               //virtual
+          void    MakeBranch(Option_t *opt=" ");                                                                  //virtual
+          void    CreateMaterials();                                                                              //virtual
+  virtual void    BuildGeometry();                                                                                //virtual
+  virtual void    CreateGeometry();                                                                               //virtual
+//private part  
+          Float_t AbsoCH4(Float_t x)const;                               //calculates absorption length for methane
+          Float_t Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)const;  //deals with Fresnel absorption
+          void    GenerateFeedbacks(Int_t iChamber,Float_t eloss=0);     //generates feedback photons; eloss=0 for photon
+          void    CreateChambers();                                      //creates set of chambers
+  inline  void    CreateHits();                                          //create hits container as a simple list
+  inline  void    CreateSDigits();                                       //create sdigits container as a simple list
+  inline  void    CreateDigits();                                        //create digits container as 7 lists, one per chamber
+  inline  void    CreateClusters();                                      //create clusters container  as 7 lists, one per chamber
+  inline  void    CreateRecos();                                         //create recos container
+//        void    ResetHits()                {AliDetector::ResetHits();}  //virtual  
+          void    ResetSDigits()             {fNsdigits=0;  if(fSdigits)  fSdigits ->Clear();}                                 
+          void    ResetDigits()              {if(fDigitsNew)for(int i=0;i<kNCH;i++){fDigitsNew->At(i)->Clear();fNdigitsNew[i]=0;}} //virtual
+          void    ResetClusters()            {if(fClusters) for(int i=0;i<kNCH;i++){fClusters ->At(i)->Clear();fNclusters[i]=0;}}
+          void    ResetRecos()               {if(fRecos) fRecos->Clear();fNrecos=0;}
   TClonesArray*   SDigits()             const{return fSdigits;}
   TClonesArray*   Digits(Int_t iC)      const{if(fDigitsNew) return (TClonesArray *)fDigitsNew->At(iC-1);else return 0;}
   TClonesArray*   Clusters(Int_t iC)    const{if(fClusters)  return (TClonesArray *)fClusters->At(iC-1);else return 0;}
   TClonesArray*   Recos()               const{return fRecos;}
-          
   AliRICHChamber* C(Int_t iC)           const{return (AliRICHChamber*)fChambers->At(iC-1);}
-  AliRICHParam*   Param()               const{return fpParam;}
   AliRICHParam*   P()                   const{return fpParam;}
-          void    CreateChambers();         
-          void    CreateMaterials(); //virtual
-  virtual void    BuildGeometry();   //virtual
-  virtual void    CreateGeometry();  //virtual
-          Float_t AbsoCH4(Float_t x)const;
-          Float_t Fresnel(Float_t ene,Float_t pdoti, Bool_t pola)const;
-  
-  virtual void    StepManager()=0;
-          void    GenerateFeedbacks(Int_t iChamber,Float_t eloss=0);//eloss=0 for photon
-          void    Print(Option_t *option)const;//virtual
-          void    MakeBranch(Option_t *opt=" ");
-          void    SetTreeAddress();//virtual
+          void    PrintDigits()         const{for(Int_t i=0;i<kNCH;i++) fDigitsNew->At(i)->Print();}
+          void    PrintClusters()       const{for(Int_t i=0;i<kNCH;i++) fClusters->At(i)->Print();}
             
-//          Int_t DistancetoPrimitive(Int_t /*px*/, Int_t /*py*/)      {return 9999;}
-    
+  void AddHit(Int_t chamber,Int_t tid,TVector3 iX3,TVector3 oX3,Double_t eloss=0)
+       {TClonesArray &tmp=*fHits;new(tmp[fNhits++])AliRICHhit(chamber,tid,iX3,oX3,eloss);} 
+  inline void AddSDigit(Int_t c,Int_t x,Int_t y,Double_t q,Int_t pid,Int_t tid); 
+  void AddDigit(int c,int x,int y,int q,int cfm,int *tid)
+       {TClonesArray &tmp=*((TClonesArray*)fDigitsNew->At(c-1));new(tmp[fNdigitsNew[c-1]++])AliRICHdigit(c,x,y,q,cfm,tid[0],tid[1],tid[2]);}  
+  void AddCluster(AliRICHcluster &cl)                     
+       {Int_t c=cl.C()-1;cout<<c<<endl;TClonesArray &tmp=*((TClonesArray*)fClusters->At(c));new(tmp[fNclusters[c]++])AliRICHcluster(cl);}
+  void AddReco(Int_t tid,Double_t thetaCherenkov,Int_t nPhotons) 
+       {TClonesArray &tmp=*(TClonesArray*)fRecos;new(tmp[fNrecos++])AliRICHreco(tid,thetaCherenkov,nPhotons);}  
+          
 protected:  
-  enum       {kCSI=6,kGAP=9};
+  enum                  {kCSI=6,kGAP=9};
   AliRICHParam         *fpParam;             //main RICH parametrization     
   TObjArray            *fChambers;           //list of RICH chambers
-  //fHits and fDigits belong to AliDetector
+  
+                                             //fHits and fDigits belong to AliDetector
   TClonesArray         *fSdigits;            //! List of sdigits  
   Int_t                 fNsdigits;           //! Current number of sdigits
   
@@ -319,5 +288,5 @@ void AliRICH::AddSDigit(Int_t c,Int_t x,Int_t y,Double_t q,Int_t pid,Int_t tid)
   TClonesArray &tmp=*fSdigits;
   new(tmp[fNsdigits++])AliRICHdigit(c,x,y,q,pid,tid,kBad,kBad);
 }//AddSDigit()   
-
+//__________________________________________________________________________________________________
 #endif//#ifndef AliRICH_h
index e694b93..1c4c752 100644 (file)
@@ -51,7 +51,7 @@ void AliRICHClusterFinder::FindLocalMaxima()
     Int_t padX1 = pDig1->X();
     Int_t padY1 = pDig1->Y();
     Int_t padQ1 = (Int_t)(pDig1->Q()+0.1);
-    Int_t padC1 = pDig1->CombiPid();
+    Int_t padC1 = pDig1->ChFbMi();
     for(Int_t iDig2=0;iDig2<fRawCluster.Size();iDig2++) {
       AliRICHdigit *pDig2 = (AliRICHdigit *)fRawCluster.Digits()->At(iDig2);
       Int_t padX2 = pDig2->X();
@@ -181,7 +181,7 @@ void  AliRICHClusterFinder::FormRawCluster(Int_t i, Int_t j)
   fHitMap->FlagHit(i,j);// Flag hit as taken  
 
   Int_t listX[4], listY[4];    //  Now look recursively for all neighbours
-  for (Int_t iNeighbour=0;iNeighbour<Rich()->Param()->PadNeighbours(i,j,listX,listY);iNeighbour++)
+  for (Int_t iNeighbour=0;iNeighbour<Rich()->P()->PadNeighbours(i,j,listX,listY);iNeighbour++)
     if(fHitMap->TestHit(listX[iNeighbour],listY[iNeighbour])==kUnused) 
                       FormRawCluster(listX[iNeighbour],listY[iNeighbour]);    
 }//FormRawCluster()
index 9fa3261..6f6eaf0 100644 (file)
@@ -37,7 +37,7 @@ Bool_t AliRICHDigitizer::Init()
 //This methode is called from AliRunDigitizer after the corresponding file is open
   if(GetDebug())Info("Init","Start.");
   fRich=(AliRICH*)gAlice->GetDetector("RICH");
-  Rich()->Param()->GenSigmaThMap();
+  Rich()->P()->GenSigmaThMap();
   return kTRUE;
 }//Init()
 //__________________________________________________________________________________________________
@@ -51,30 +51,41 @@ void AliRICHDigitizer::Exec(Option_t*)
   pOutAL = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName());
   pOutRL = pOutAL->GetLoader("RICHLoader");
   pOutRL->MakeTree("D");   Rich()->MakeBranch("D"); //create TreeD with RICH branches in output stream
+  
+  TClonesArray tmpCA("AliRICHdigit");//tmp storage for sdigits sum up from all input files
+  Int_t total=0;
   for(Int_t inFileN=0;inFileN<fManager->GetNinputs();inFileN++){//files loop
-    pInAL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inFileN)); pInRL = pInAL->GetLoader("RICHLoader");
-    pInRL->LoadSDigits(); pInAL->GetEvent(fManager->GetOutputEventNr()); pInRL->TreeS()->GetEntry(0);
-    pInRL->UnloadSDigits();
+    pInAL = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(inFileN)); 
+    pInRL = pInAL->GetLoader("RICHLoader"); if(pInRL==0) continue;//no RICH in this input, check the next input
+    pInRL->LoadSDigits(); pInAL->GetEvent(fManager->GetInputEventNumber(fManager->GetOutputEventNr(),0)); pInRL->TreeS()->GetEntry(0);
+    Info("Exec","input %i has %i sdigits",inFileN,Rich()->SDigits()->GetEntries());
+    for(Int_t i=0;i<Rich()->SDigits()->GetEntries();i++) new(tmpCA[total++]) AliRICHdigit(*(AliRICHdigit*)Rich()->SDigits()->At(i)); 
+    pInRL->UnloadSDigits();   Rich()->ResetSDigits();
   }//files loop
   
-  Rich()->SDigits()->Sort();                     //sort them according to Id() methode
-  Int_t combiPid=0,chamber=0,x=0,y=0,tid[3],id=0; Double_t q=0;
+  tmpCA.Sort();                     //sort them according to Id() methode
+  
+  Int_t chFbMip=0,chamber=0,x=0,y=0,tid[3],id=0; Double_t q=0;
   Int_t iNdigitsPerPad=0;//how many sdigits for a given pad
-  for(Int_t i=0;i<Rich()->SDigits()->GetEntries();i++){//sdigits loop (sorted)
-    AliRICHdigit *pSdig=(AliRICHdigit*)Rich()->SDigits()->At(i);
+  for(Int_t i=0;i<tmpCA.GetEntries();i++){//sdigits loop (sorted)
+    AliRICHdigit *pSdig=(AliRICHdigit*)tmpCA.At(i);//get new sdigit
     if(pSdig->Id()==id){//still the same pad
-      iNdigitsPerPad++;         q+=pSdig->Q();       combiPid+=pSdig->CombiPid();//sum up charge and cfm
+      iNdigitsPerPad++;         q+=pSdig->Q();       chFbMip+=pSdig->ChFbMi();//sum up charge and cfm
       if(iNdigitsPerPad<=3)        tid[iNdigitsPerPad-1]=pSdig->Tid(0);
-      else                         Warning("SDigits2Digits","More then 3 sdigits for the given pad");
+      else                         if(GetDebug())Warning("Exec","More then 3 sdigits for the given pad");
     }else{//new pad, add the pevious one
-        if(id!=kBad&&Rich()->Param()->IsOverTh(chamber,x,y,q)) Rich()->AddDigit(chamber,x,y,(Int_t)q,combiPid,tid); //add newly created dig
-        combiPid=pSdig->CombiPid(); chamber=pSdig->C(); id=pSdig->Id();  x=pSdig->X(); y=pSdig->Y(); q=pSdig->Q();  //init all values by current sdig
+        if(id!=kBad&&Rich()->P()->IsOverTh(chamber,x,y,q)) Rich()->AddDigit(chamber,x,y,(Int_t)q,chFbMip,tid); //add newly created dig
+        chFbMip=pSdig->ChFbMi(); chamber=pSdig->C(); id=pSdig->Id();  x=pSdig->X(); y=pSdig->Y(); q=pSdig->Q();  //init all values by current sdig
         iNdigitsPerPad=1; tid[0]=pSdig->Tid(0); tid[1]=tid[2]=kBad;
       }
   }//sdigits loop (sorted)
-  if(Rich()->SDigits()->GetEntries()&&Rich()->Param()->IsOverTh(chamber,x,y,q)) Rich()->AddDigit(chamber,x,y,(Int_t)q,combiPid,tid);//add the last dig
+  if(tmpCA.GetEntries()&&Rich()->P()->IsOverTh(chamber,x,y,q)) Rich()->AddDigit(chamber,x,y,(Int_t)q,chFbMip,tid);//add the last dig
+  
   pOutRL->TreeD()->Fill();              //fill the tree with the list of digits
   pOutRL->WriteDigits("OVERWRITE");     //serialize them to file
+  
+  tmpCA.Clear();
+  pOutRL->UnloadDigits();   Rich()->ResetDigits();
             
   if(GetDebug())Info("Exec","Stop.");
 }//Exec()
index b171449..610e55f 100644 (file)
 #include <TStyle.h>
 #include <TH2.h>
 #include <TMath.h>
+#include <TLatex.h>
 
 ClassImp(AliRICHDisplFast)
 
 //__________________________________________________________________________________________________
 void AliRICHDisplFast::Exec()
 {
-  TH2F *pHitsH2     = new TH2F("pHitsH2"  ,  "Event Display",165,-AliRICHParam::PcSizeX()/2,AliRICHParam::PcSizeX()/2,
+  AliRICH *pRich = (AliRICH*)gAlice->GetDetector("RICH");
+  Bool_t isHits    =!pRich->GetLoader()->LoadHits();
+  Bool_t isDigits  =!pRich->GetLoader()->LoadDigits();
+  Bool_t isClusters=!pRich->GetLoader()->LoadRecPoints();
+  
+  if(!isHits && !isDigits && !isClusters){Error("Exec","No hits digits and clusters. Nothing to display.");return;}
+  
+  TCanvas *Display = new TCanvas("Display","RICH Display",0,0,600,600);
+  gStyle->SetPalette(1);
+  
+  TH2F *pHitsH2=0,*pDigitsH2=0,*pClustersH2=0;
+  
+  if(isHits)     pHitsH2     = new TH2F("pHitsH2"  ,  "Event Display",165,-AliRICHParam::PcSizeX()/2,AliRICHParam::PcSizeX()/2,
                                                              144,-AliRICHParam::PcSizeY()/2,AliRICHParam::PcSizeY()/2);
-  pHitsH2->SetStats(kFALSE);
-  TH2F *pDigitsH2   = new TH2F("pDigitsH2"  ,"Event Display",165,-AliRICHParam::PcSizeX()/2,AliRICHParam::PcSizeX()/2,
+  if(pHitsH2)    pHitsH2->SetStats(kFALSE);
+  
+  if(isDigits)   pDigitsH2   = new TH2F("pDigitsH2"  ,"Event Display",165,-AliRICHParam::PcSizeX()/2,AliRICHParam::PcSizeX()/2,
                                                              144,-AliRICHParam::PcSizeY()/2,AliRICHParam::PcSizeY()/2);
-  TH2F *pClustersH2 = new TH2F("pClustersH2","Event Display",165,-AliRICHParam::PcSizeX()/2,AliRICHParam::PcSizeX()/2,
+  if(isClusters) pClustersH2 = new TH2F("pClustersH2","Event Display",165,-AliRICHParam::PcSizeX()/2,AliRICHParam::PcSizeX()/2,
                                                              144,-AliRICHParam::PcSizeY()/2,AliRICHParam::PcSizeY()/2);
 
-  TCanvas *Display = new TCanvas("Display","RICH Display",0,0,600,600);
     
-  gStyle->SetPalette(1);
 
-  AliRICH *pRich = (AliRICH*)gAlice->GetDetector("RICH");
-  pRich->GetLoader()->LoadRecPoints();
-  pRich->GetLoader()->LoadDigits();
-  pRich->GetLoader()->LoadHits();
+  
   for(Int_t iEventN=0;iEventN<gAlice->GetEventsPerRun();iEventN++){//events Loop
     pRich->GetLoader()->GetRunLoader()->GetEvent(iEventN);
-    pRich->GetLoader()->TreeD()->GetEntry(0);
-    pRich->GetLoader()->TreeR()->GetEntry(0);
 
   
     Int_t nPrimaries = (Int_t)pRich->GetLoader()->TreeH()->GetEntries();
@@ -60,64 +67,68 @@ void AliRICHDisplFast::Exec()
       for(Int_t k=0;k<nHits;k++)         Hits[i].Add(pRich->Hits()->At(k));
     
     }
-           
-    for(Int_t iChamber=1;iChamber<=7;iChamber++){//modules loop
-    
-     Int_t nDigits   = pRich->Digits(iChamber)->GetEntries();
-     Int_t nClusters = pRich->Clusters(iChamber)->GetEntries();
-   
-     pHitsH2->Reset();     pDigitsH2->Reset();     pClustersH2->Reset();
-
-
+//display all the staff on chamber by chamber basis           
+    for(Int_t iChamber=1;iChamber<=7;iChamber++){//chambers loop       
+      if(isHits)     pHitsH2    ->Reset();     
+      if(isDigits)   pDigitsH2  ->Reset();     
+      if(isClusters) pClustersH2->Reset();
+//deals with hits
       for(Int_t i=0;i<nPrimaries;i++){//prims loop
         pRich->GetLoader()->TreeH()->GetEntry(i);
         Int_t nHits = pRich->Hits()->GetEntries();
         for(Int_t j=0;j<nHits;j++){//hits loop
           AliRICHhit *pHit = (AliRICHhit*)Hits[i].At(j);
           if(pHit->C()==iChamber){
-            TVector3 xyzhit(pHit->X(),pHit->Y(),pHit->Z());
-            TVector2 hitlocal = pRich->C(iChamber)->Glob2Loc(xyzhit);
-            pHitsH2->Fill(hitlocal.X(),hitlocal.Y(),200);
+            TVector3 hitGlobX3= pHit->OutX3();
+            TVector2 hitLocX2 = pRich->C(iChamber)->Glob2Loc(hitGlobX3);
+            pHitsH2->Fill(hitLocX2.X(),hitLocX2.Y(),200);
           }//if
         }//hits loop         
       }//prims loop
-     
-      for(Int_t j=0;j<nDigits;j++){//digits loop
-        AliRICHdigit *pDigit = (AliRICHdigit*)pRich->Digits(iChamber)->At(j);
-       TVector2 x2=AliRICHParam::Pad2Loc(pDigit->X(),pDigit->Y());
-       pDigitsH2->Fill(x2.X(),x2.Y(),100);
-      }//digits loop
-        
-      for(Int_t j=0;j<nClusters;j++){//clusters loop
-        AliRICHcluster *pCluster = (AliRICHcluster*)pRich->Clusters(iChamber)->At(j);
-        pClustersH2->Fill(pCluster->X(),pCluster->Y(),50);
-      }//clusters loop
-
-      pHitsH2->SetTitle(Form("event %i module %2i",iEventN,iChamber));
+      pHitsH2->SetTitle(Form("event %i chamber %2i",iEventN,iChamber));
       pHitsH2->SetMarkerColor(kRed); pHitsH2->SetMarkerStyle(29); pHitsH2->SetMarkerSize(0.4);
       pHitsH2->Draw();
       DrawSectors();
+      TLatex l; l.SetNDC(); l.SetTextSize(0.02);
+      if(!isHits)     {l.SetTextColor(kRed)  ;l.DrawLatex(0.1,0.01,"No Hits"    );}
+      if(!isDigits)   {l.SetTextColor(kGreen);l.DrawLatex(0.4,0.01,"No DIGITS"  );}
+      if(!isClusters) {l.SetTextColor(kBlue) ;l.DrawLatex(0.8,0.01,"No CLUSTERS");}
       Display->Update();
       Display->Modified();
-      getchar();
-             
-      pDigitsH2->SetMarkerColor(kGreen); pDigitsH2->SetMarkerStyle(29); pDigitsH2->SetMarkerSize(0.4);
-      pDigitsH2->Draw("same");
-      Display->Update();
-      Display->Modified();       
-      getchar();
-      
-      pClustersH2->SetMarkerColor(kBlue); pClustersH2->SetMarkerStyle(29);  pClustersH2->SetMarkerSize(0.4);
-      pClustersH2->Draw("same");
-      Display->Update();
-      Display->Modified();
-      getchar();
-     }//modules loop
+      getchar();             
+//deals with digits      
+      if(isDigits){
+        pRich->GetLoader()->TreeD()->GetEntry(0);
+        for(Int_t j=0;j<pRich->Digits(iChamber)->GetEntries();j++){//digits loop
+          AliRICHdigit *pDig = (AliRICHdigit*)pRich->Digits(iChamber)->At(j);
+         TVector2 x2=AliRICHParam::Pad2Loc(pDig->X(),pDig->Y());
+         pDigitsH2->Fill(x2.X(),x2.Y(),100);
+        }//digits loop
+        pDigitsH2->SetMarkerColor(kGreen); pDigitsH2->SetMarkerStyle(29); pDigitsH2->SetMarkerSize(0.4);
+        pDigitsH2->Draw("same");
+        Display->Update();
+        Display->Modified();       
+        getchar();
+      }//if(isDigits)      
+//deals with clusters      
+      if(isClusters){
+        pRich->GetLoader()->TreeR()->GetEntry(0);
+        for(Int_t j=0;j<pRich->Clusters(iChamber)->GetEntries();j++){//clusters loop
+          AliRICHcluster *pClus = (AliRICHcluster*)pRich->Clusters(iChamber)->At(j);
+          pClustersH2->Fill(pClus->X(),pClus->Y(),50);
+        }//clusters loop
+        pClustersH2->SetMarkerColor(kBlue); pClustersH2->SetMarkerStyle(29);  pClustersH2->SetMarkerSize(0.4);
+        pClustersH2->Draw("same");
+        Display->Update();
+        Display->Modified();
+        getchar();
+      }//if(isClusters)
+    }//chambers loop
     delete [] Hits;
-  }////events Loop
-  pRich->GetLoader()->UnloadRecPoints();
-  pRich->GetLoader()->UnloadDigits();
+  }//events Loop
   pRich->GetLoader()->UnloadHits();
+  if(isDigits)   pRich->GetLoader()->UnloadDigits();
+  if(isClusters) pRich->GetLoader()->UnloadRecPoints();
 }//Exec()
 //__________________________________________________________________________________________________
 void AliRICHDisplFast::DrawSectors() 
@@ -182,22 +193,10 @@ void AliRICHDisplFast::DrawSectors()
                     -AliRICHParam::DeadZone()/2,
                     -AliRICHParam::DeadZone()/2,
                     -AliRICHParam::PcSizeY()/2};
-  TPolyLine *sector1 = new TPolyLine(5,x1,y1);
-  TPolyLine *sector2 = new TPolyLine(5,x2,y2);
-  TPolyLine *sector3 = new TPolyLine(5,x3,y3);
-  TPolyLine *sector4 = new TPolyLine(5,x4,y4);
-  TPolyLine *sector5 = new TPolyLine(5,x5,y5);
-  TPolyLine *sector6 = new TPolyLine(5,x6,y6);
-  sector1->SetLineColor(21);
-  sector2->SetLineColor(21);
-  sector3->SetLineColor(21);
-  sector4->SetLineColor(21);
-  sector5->SetLineColor(21);
-  sector6->SetLineColor(21);
-  sector1->Draw();
-  sector2->Draw();
-  sector3->Draw();
-  sector4->Draw();
-  sector5->Draw();
-  sector6->Draw();
-}
+  TPolyLine *sector1 = new TPolyLine(5,x1,y1);  sector1->SetLineColor(21);  sector1->Draw();
+  TPolyLine *sector2 = new TPolyLine(5,x2,y2);  sector2->SetLineColor(21);  sector2->Draw();
+  TPolyLine *sector3 = new TPolyLine(5,x3,y3);  sector3->SetLineColor(21);  sector3->Draw();
+  TPolyLine *sector4 = new TPolyLine(5,x4,y4);  sector4->SetLineColor(21);  sector4->Draw();
+  TPolyLine *sector5 = new TPolyLine(5,x5,y5);  sector5->SetLineColor(21);  sector5->Draw();
+  TPolyLine *sector6 = new TPolyLine(5,x6,y6);  sector6->SetLineColor(21);  sector6->Draw();
+}//DrawSectors()
index 12c9926..ea21d56 100644 (file)
@@ -14,8 +14,8 @@ class AliRICHDisplFast : public TTask
 {
 public :
  
-       AliRICHDisplFast() {;}
-      ~AliRICHDisplFast() {;}
+           AliRICHDisplFast() {;}
+  virtual ~AliRICHDisplFast() {;}
       
   void DrawSectors(); //Draw sectors in plot 
   void Exec();//virtual
index d45322c..a2bf706 100644 (file)
@@ -19,7 +19,8 @@
 ClassImp(AliRICHMap)
 
 AliRICHMap::AliRICHMap(TClonesArray *pDig)
-{//main ctor
+{
+// main ctor
   fDigits=pDig;
   fNdigits=fDigits->GetEntries();
   fMap=new TMatrix(1,AliRICHParam::NpadsX(),1,AliRICHParam::NpadsY());
@@ -28,7 +29,8 @@ AliRICHMap::AliRICHMap(TClonesArray *pDig)
 }
 //__________________________________________________________________________________________________   
 void  AliRICHMap::FillHits()
-{//Fill hits into HitMap
+{
+// Loops over the list of digits filling the "pad fired by digits" structure
   if(!fNdigits) return;    
   for(Int_t iDigN=0;iDigN<fNdigits;iDigN++){
     AliRICHdigit *pDig= (AliRICHdigit*)fDigits->At(iDigN);
index 2ea3708..cca94dd 100644 (file)
@@ -15,26 +15,27 @@ class AliRICHMap : public AliHitMap
 public:
            AliRICHMap(TClonesArray *pDig);
   virtual ~AliRICHMap()                          {delete fMap;}
-  void     FillHits();                                           //virtual
-  void     Clear(const char *)                   {fMap->Zero();}                                             //virtual  
-  void     DeleteHit(Int_t ix,Int_t iy)          {(*fMap)(ix,iy)=0;}                                            //virtual
-  void     SetHit(Int_t ix,Int_t iy,Int_t idigit){(*fMap)(ix,iy)=idigit+1;}                                     //virtual  
-  Int_t    GetHitIndex(Int_t ix,Int_t iy)   const{return (Int_t)TMath::Abs((*fMap)(ix, iy))-1;}                       //virtual
+  void     FillHits();                                                                                             //virtual
+  void     Clear(const char *)                   {fMap->Zero();}                                                   //virtual  
+  void     DeleteHit(Int_t ix,Int_t iy)          {(*fMap)(ix,iy)=0;}                                               //virtual
+  void     SetHit(Int_t ix,Int_t iy,Int_t idigit){(*fMap)(ix,iy)=idigit+1;}                                        //virtual  
+  Int_t    GetHitIndex(Int_t ix,Int_t iy)   const{return (Int_t)TMath::Abs((*fMap)(ix, iy))-1;}                    //virtual
   TObject* GetHit(Int_t ix,Int_t iy)        const{Int_t idx=GetHitIndex(ix,iy);return(idx <0)?0:fDigits->At(idx);} //virtual
-  void     FlagHit(Int_t ix,Int_t iy)            {(*fMap)(ix, iy)=-TMath::Abs((*fMap)(ix,iy));}                          //virtual
-  Bool_t   ValidateHit(Int_t,Int_t)              {return 1;}                                                 //virtual
-  void     Print()                          const{fMap->Print();}
-  inline   FlagType TestHit(Int_t ix,Int_t iy);                                                              //virtual
+  void     FlagHit(Int_t ix,Int_t iy)            {(*fMap)(ix, iy)=-TMath::Abs((*fMap)(ix,iy));}                    //virtual
+  Bool_t   ValidateHit(Int_t,Int_t)              {return 1;}                                                       //virtual
+  inline   FlagType TestHit(Int_t ix,Int_t iy);                                                                    //virtual
+  void     Print()                          const{fMap->Print();}                                                  
 protected:
   TClonesArray *fDigits;                                 //List of digits
   Int_t         fNdigits;                                //Number of digits
   TMatrix      *fMap;                                    //hit map
   ClassDef(AliRICHMap,0)                                 //Implements map as TMatrix
 };
-//__________________________________________________________________________________________________  
-FlagType AliRICHMap::TestHit(Int_t ix,Int_t iy)
-{//Is there a hit?
-  Int_t inf=(Int_t)(*fMap)(ix, iy);
+//__________________________________________________________________________________________________
+FlagType AliRICHMap::TestHit(Int_t padx,Int_t pady)
+{
+//Is there a hit for given pad?
+  Int_t inf=(Int_t)(*fMap)(padx,pady);
   if(inf<0){//flaged as used
     return kUsed;
   }else if(inf==0){//no hit 
@@ -42,5 +43,5 @@ FlagType AliRICHMap::TestHit(Int_t ix,Int_t iy)
   }else{//index of not yet used hit
     return kUnused;
   }
-}  
+}//TestHit()  
 #endif 
index c2b4423..6a67f35 100644 (file)
@@ -10,8 +10,8 @@ public:
   
           KirConfig(const char*sFileName);
          ~KirConfig()                    {Info("ctor","");fMain->Cleanup(); delete fMain;}
-  void    AddDetector(Int_t id)          {fDetectors+=id;}
-  void    RemoveDetector(Int_t id)       {fDetectors-=id;}
+  void    AddDetector(Int_t id)          {fDetectors+=id; if(id==kTRD) fDetButGrp->SetButton(kFRAME);}
+  void    RemoveDetector(Int_t id)       {fDetectors-=id; if(id==kFRAME&&IsDetectorOn(kTRD)) fDetButGrp->SetButton(kTRD,kFALSE);}
   void    AddProcess(Int_t id)           {fProcesses+=id;}
   void    RemoveProcess(Int_t id)        {fProcesses-=id;}
   Bool_t  IsDetectorOn(Int_t id)    const{return fDetectors&id;}
@@ -20,11 +20,10 @@ public:
   void    CreateConfigFile();
 protected:
   TGMainFrame  *fMain;//main window poiter
-  TGComboBox   *fRichVersionCombo;
-  TGButton     *fRichTopChkBtn, *fMagFldChkBtn;
-  TGComboBox   *fGenTypeCombo,*fGenPartIdCombo,*fGenMomCombo;
-  TGNumberEntry *fGenNprimEntry;
-  Int_t         fDetectors;
+  TGComboBox   *fRichVersionCombo;  TGButton *fRichTopChkBtn;//RICH
+  TGButton     *fMagFldChkBtn;                               //MAG
+  TGComboBox   *fGenTypeCombo,*fGenPartIdCombo,*fGenMomCombo,*fGenChamberCombo; TGNumberEntry *fGenNprimEntry;//GEN
+  Int_t         fDetectors; TGButtonGroup *fDetButGrp;       //DETECTORS
   Int_t         fProcesses;
   char         *fFileName;
 };//class KirConfig
@@ -32,6 +31,7 @@ protected:
 KirConfig::KirConfig(const char *sFileName)
 {   
   fFileName=sFileName;
+  fDetectors=0;
 // Create main frame       
   fMain=new TGMainFrame(gClient->GetRoot(),500,400);
 //  fMain->Connect("CloseWindow()","KirConfig",this,"CloseWindow()");   
@@ -40,29 +40,30 @@ KirConfig::KirConfig(const char *sFileName)
   pHorFrame->AddFrame(pVerFrame=new TGVerticalFrame(pHorFrame,100,200));  
   pVerFrame->AddFrame(pRichGrpFrm=new TGGroupFrame(pHorFrame,"RICH"));
   pRichGrpFrm->AddFrame(fRichVersionCombo=new TGComboBox(pRichGrpFrm,100));
-  fRichVersionCombo->AddEntry("version 0",0);  fRichVersionCombo->AddEntry("version 1",1);  fRichVersionCombo->AddEntry("version 3",3);
-  fRichVersionCombo->Select(1);  fRichVersionCombo->Resize(140,20);
+  fRichVersionCombo->AddEntry("no RICH",-1);
+  fRichVersionCombo->AddEntry("version 0",0);  
+  fRichVersionCombo->AddEntry("version 1",1);
+  fRichVersionCombo->Select(1);  fRichVersionCombo->Resize(160,20);
   pRichGrpFrm->AddFrame(fRichTopChkBtn=new TGCheckButton(pRichGrpFrm,"Rotate to Top?"));
 //Generator  
   pVerFrame->AddFrame(pGenGrpFrm=new TGGroupFrame(pHorFrame,"Generator"));
   pGenGrpFrm->AddFrame(fGenTypeCombo=new TGComboBox(pGenGrpFrm,100));
-  fGenTypeCombo->AddEntry("gun to central chamber",kGun1);  fGenTypeCombo->AddEntry("gun to all chambers",kGun7);
+  fGenTypeCombo->AddEntry("gun to single chamber",kGun1);  fGenTypeCombo->AddEntry("gun to all chambers",kGun7);
   fGenTypeCombo->AddEntry("7 guns on top of Pythia",kPythia7);
   fGenTypeCombo->AddEntry("HIJING",kHijing);                fGenTypeCombo->AddEntry("parametrized HIJING",kHijingPara);
   fGenTypeCombo->Select(kHijingPara);
   fGenTypeCombo->Resize(160,20);
   
-  pGenGrpFrm->AddFrame(fGenPartIdCombo=new TGComboBox(pGenGrpFrm,100));
+  pGenGrpFrm->AddFrame(fGenPartIdCombo=new TGComboBox(pGenGrpFrm,100)); //PID for guns
   fGenPartIdCombo->AddEntry("Pion+",kPiPlus);
   fGenPartIdCombo->AddEntry("Pion-",kPiMinus);
   fGenPartIdCombo->AddEntry("Kaon+",kKPlus);
   fGenPartIdCombo->AddEntry("Kaon-",kKMinus);
   fGenPartIdCombo->AddEntry("Proton",kProton);
   fGenPartIdCombo->AddEntry("AntiProton",kProtonBar);
-  fGenPartIdCombo->Select(kPiPlus);
-  fGenPartIdCombo->Resize(160,20);
+  fGenPartIdCombo->Select(kPiPlus);  fGenPartIdCombo->Resize(160,20);
 
-  pGenGrpFrm->AddFrame(fGenMomCombo=new TGComboBox(pGenGrpFrm,100));
+  pGenGrpFrm->AddFrame(fGenMomCombo=new TGComboBox(pGenGrpFrm,100)); //particle energy for guns
   fGenMomCombo->AddEntry("1.5 GeV",15);
   fGenMomCombo->AddEntry("2.0 Gev",20);
   fGenMomCombo->AddEntry("2.5 GeV",25);
@@ -70,10 +71,13 @@ KirConfig::KirConfig(const char *sFileName)
   fGenMomCombo->AddEntry("3.5 GeV",35);
   fGenMomCombo->AddEntry("4.0 GeV",40);
   fGenMomCombo->AddEntry("4.5 GeV",45);
-  fGenMomCombo->Select(40);
-  fGenMomCombo->Resize(160,20);
+  fGenMomCombo->Select(40);  fGenMomCombo->Resize(160,20);
   
-  pGenGrpFrm->AddFrame(pGenNprimFrm=new TGGroupFrame(pGenGrpFrm,"Number of primiries"));
+  pGenGrpFrm->AddFrame(fGenChamberCombo=new TGComboBox(pGenGrpFrm,100)); //chamber number in case of gun1
+  for(int i=1;i<=7;i++) fGenChamberCombo->AddEntry(Form("Chamber %i",i),i);
+  fGenChamberCombo->Select(4); fGenChamberCombo->Resize(160,20);
+  
+  pGenGrpFrm->AddFrame(pGenNprimFrm=new TGGroupFrame(pGenGrpFrm,"Number of primiries"));//number of primiries in case of HIJING
   pGenNprimFrm->AddFrame(fGenNprimEntry=new TGNumberEntry(pGenNprimFrm,500));
   
 // Magnetic Field
@@ -81,29 +85,29 @@ KirConfig::KirConfig(const char *sFileName)
   pFldGrpFrm->AddFrame(fMagFldChkBtn=new TGCheckButton(pFldGrpFrm,"On/Off"));
   fMagFldChkBtn->SetState(kButtonUp);
 //Detectors
-  pHorFrame->AddFrame(pDetButGrp=new TGButtonGroup(pHorFrame,"Detectors"));
-  pDetButGrp->Connect("Pressed(Int_t)","KirConfig",this,"AddDetector(Int_t)");
-  pDetButGrp->Connect("Released(Int_t)","KirConfig",this,"RemoveDetector(Int_t)");
-  new TGCheckButton(pDetButGrp,"PIPE"  ,kPIPE));         
-  new TGCheckButton(pDetButGrp,"ITS"   ,kITS));         
-  new TGCheckButton(pDetButGrp,"TPC"   ,kTPC));
-  new TGCheckButton(pDetButGrp,"TRD"   ,kTRD));
-  new TGCheckButton(pDetButGrp,"TOF"   ,kTOF));         
-  new TGCheckButton(pDetButGrp,"FRAME" ,kFRAME));         
-  new TGCheckButton(pDetButGrp,"MAG"   ,kMAG));         
-  new TGCheckButton(pDetButGrp,"CRT"   ,kCRT));         
-  new TGCheckButton(pDetButGrp,"HALL"  ,kHALL));         
-  new TGCheckButton(pDetButGrp,"PHOS"  ,kPHOS));         
-  new TGCheckButton(pDetButGrp,"START" ,kSTART));         
-  new TGCheckButton(pDetButGrp,"FMD"   ,kFMD));         
-  new TGCheckButton(pDetButGrp,"ABSO"  ,kABSO));         
-  new TGCheckButton(pDetButGrp,"PMD"   ,kPMD));         
-  new TGCheckButton(pDetButGrp,"DIPO"  ,kDIPO));         
-  new TGCheckButton(pDetButGrp,"EMCAL" ,kEMCAL));         
-  new TGCheckButton(pDetButGrp,"VZERO" ,kVZERO));         
-  new TGCheckButton(pDetButGrp,"MUON"  ,kMUON));         
-  new TGCheckButton(pDetButGrp,"ZDC"   ,kZDC));         
-  new TGCheckButton(pDetButGrp,"SHILD" ,kSHILD));         
+  pHorFrame->AddFrame(fDetButGrp=new TGButtonGroup(pHorFrame,"Detectors"));
+  fDetButGrp->Connect("Pressed(Int_t)","KirConfig",this,"AddDetector(Int_t)");
+  fDetButGrp->Connect("Released(Int_t)","KirConfig",this,"RemoveDetector(Int_t)");
+  new TGCheckButton(fDetButGrp,"PIPE"  ,kPIPE));         
+  new TGCheckButton(fDetButGrp,"ITS"   ,kITS));         
+  new TGCheckButton(fDetButGrp,"TPC"   ,kTPC));
+  new TGCheckButton(fDetButGrp,"TRD"   ,kTRD));
+  new TGCheckButton(fDetButGrp,"TOF"   ,kTOF));         
+  new TGCheckButton(fDetButGrp,"FRAME" ,kFRAME));         
+  new TGCheckButton(fDetButGrp,"MAG"   ,kMAG));         
+  new TGCheckButton(fDetButGrp,"CRT"   ,kCRT));         
+  new TGCheckButton(fDetButGrp,"HALL"  ,kHALL));         
+  new TGCheckButton(fDetButGrp,"PHOS"  ,kPHOS));         
+  new TGCheckButton(fDetButGrp,"START" ,kSTART));         
+  new TGCheckButton(fDetButGrp,"FMD"   ,kFMD));         
+  new TGCheckButton(fDetButGrp,"ABSO"  ,kABSO));         
+  new TGCheckButton(fDetButGrp,"PMD"   ,kPMD));         
+  new TGCheckButton(fDetButGrp,"DIPO"  ,kDIPO));         
+  new TGCheckButton(fDetButGrp,"EMCAL" ,kEMCAL));         
+  new TGCheckButton(fDetButGrp,"VZERO" ,kVZERO));         
+  new TGCheckButton(fDetButGrp,"MUON"  ,kMUON));         
+  new TGCheckButton(fDetButGrp,"ZDC"   ,kZDC));         
+  new TGCheckButton(fDetButGrp,"SHILD" ,kSHILD));         
 //Processes  
   pHorFrame->AddFrame(pProcButGrp=new TGButtonGroup(pHorFrame,"Processes"));
   pProcButGrp->Connect("Pressed(Int_t)","KirConfig",this,"AddProcess(Int_t)");
@@ -183,14 +187,15 @@ void KirConfig::CreateConfigFile()
   fprintf(fp,"  pAL->CdGAFile();\n\n");                                 //????       
 //BODY-ALIC 
   fprintf(fp,"  new AliBODY(\"BODY\",\"Alice envelop\");\n\n");
-//RICH  
-  if(fRichTopChkBtn->GetState()==kButtonDown) fprintf(fp,"  AliRICHParam::AngleRot(0);\n");
-  switch(fRichVersionCombo->GetSelected()){//RICH
-    case 0:   fprintf(fp,"  pRICH=new AliRICHv0(\"RICH\",\"RICH version 0\");\n"); break;   
-    case 1:   fprintf(fp,"  pRICH=new AliRICHv1(\"RICH\",\"RICH version 1\");\n"); break;   
-    case 3:   fprintf(fp,"  pRICH=new AliRICHv3(\"RICH\",\"RICH version 3\");\n"); break;   
+//RICH
+  if(fRichVersionCombo->GetSelected() != -1){  
+    if(fRichTopChkBtn->GetState()==kButtonDown) fprintf(fp,"  AliRICHParam::AngleRot(0);\n");
+    switch(fRichVersionCombo->GetSelected()){//RICH
+      case 0:   fprintf(fp,"  pRICH=new AliRICHv0(\"RICH\",\"RICH version 0\");\n"); break;   
+      case 1:   fprintf(fp,"  pRICH=new AliRICHv1(\"RICH\",\"RICH version 1\");\n"); break;   
+    }
+    fprintf(fp,"  ::Info(\"RICH private config\",\"version %i\");\n\n",fRichVersionCombo->GetSelected()); 
   }
-  fprintf(fp,"  ::Info(\"RICH private config\",\"version %i\");\n\n",fRichVersionCombo->GetSelected()); 
 //Generator
   switch(fGenTypeCombo->GetSelected()){
     case kHijingPara: 
@@ -202,7 +207,7 @@ void KirConfig::CreateConfigFile()
     case kGun1:     
       fprintf(fp,"  AliGenFixed *pGen=new AliGenFixed(1);\n");  
       fprintf(fp,"  pGen->SetPart(%i); pGen->SetMomentum(%3.1f); pGen->SetOrigin(0,0,0);\n",fGenPartIdCombo->GetSelected(),float(fGenMomCombo->GetSelected())/10);  
-      fprintf(fp,"  pGen->SetPhiRange(pRICH->C(4)->PhiD()); pGen->SetThetaRange(pRICH->C(4)->ThetaD()-2);\n");            
+      fprintf(fp,"  pGen->SetPhiRange(pRICH->C(%i)->PhiD()); pGen->SetThetaRange(pRICH->C(%i)->ThetaD()-2);\n",fGenChamberCombo->GetSelected(),fGenChamberCombo->GetSelected());            
       fprintf(fp,"  pGen->Init();\n");
     break;    
     case kGun7:   
@@ -229,15 +234,9 @@ void KirConfig::CreateConfigFile()
       fprintf(fp,"  pCocktail->Init();\n");
     break;  
   }
-//Other detectors                  
-  if(IsDetectorOn(kMAG))  fprintf(fp,"\n  new AliMAG(\"MAG\",\"Magnet\");\n");
-  if(IsDetectorOn(kABSO)) fprintf(fp,"\n  new AliABSOv0(\"ABSO\",\"Muon absorber\");\n");
-  if(IsDetectorOn(kDIPO)) fprintf(fp,"\n  new AliDIPOv2(\"DIPO\",\"Dipole version 2\");\n");
-  if(IsDetectorOn(kHALL)) fprintf(fp,"\n  new AliHALL(\"HALL\",\"Alice Hall\");\n");
-  if(IsDetectorOn(kFRAME))fprintf(fp,"\n  AliFRAMEv2 *pFrame=new AliFRAMEv2(\"FRAME\",\"Space Frame\"); pFrame->SetHoles(1);\n");
-  if(IsDetectorOn(kSHILD))fprintf(fp,"\n  new AliSHILv2(\"SHIL\",\"Shielding Version 2\");\n");
+//central before RICH detectors                  
   if(IsDetectorOn(kPIPE)) fprintf(fp,"\n  new AliPIPEv0(\"PIPE\",\"Beam Pipe\");\n");
-  
+  if(IsDetectorOn(kSHILD))fprintf(fp,"\n  new AliSHILv2(\"SHIL\",\"Shielding Version 2\");\n");  
   if(IsDetectorOn(kITS)){
     fprintf(fp,"\n  AliITSvPPRasymmFMD *pIts =new AliITSvPPRasymmFMD(\"ITS\",\"ITS PPR detailed version\");\n");
     fprintf(fp,"  pIts->SetMinorVersion(2); pIts->SetReadDet(kTRUE);\n");
@@ -245,24 +244,30 @@ void KirConfig::CreateConfigFile()
     fprintf(fp,"  pIts->SetThicknessChip1(200.); pIts->SetThicknessChip2(200.);\n");
     fprintf(fp,"  pIts->SetRails(0); pIts->SetCoolingFluid(1);\n");
     fprintf(fp,"  pIts->SetEUCLID(0);\n");
-  }
-  
-  if(IsDetectorOn(kTPC)){fprintf(fp,"\n  AliTPC *pTpc=new AliTPCv2(\"TPC\",\"Default\"); pTpc->SetSecAU(-1);pTpc->SetSecAL(-1);\n");}
-  if(IsDetectorOn(kZDC))fprintf(fp,"\n  new AliZDCv2(\"ZDC\",\"normal ZDC\");\n");
-  
+  }  
+  if(IsDetectorOn(kTPC)) {fprintf(fp,"\n  AliTPC *pTpc=new AliTPCv2(\"TPC\",\"Default\"); pTpc->SetSecAU(-1);pTpc->SetSecAL(-1);\n");}  
+  if(IsDetectorOn(kFRAME))fprintf(fp,"\n  AliFRAMEv2 *pFrame=new AliFRAMEv2(\"FRAME\",\"Space Frame\"); pFrame->SetHoles(1);\n");
   if(IsDetectorOn(kTRD)){
     fprintf(fp,"\n  AliTRD *pTrd=new AliTRDv1(\"TRD\",\"TRD slow simulator\");\n");
     fprintf(fp,"  pTrd->SetGasMix(1); pTrd->SetPHOShole(); pTrd->SetRICHhole();pTrd->CreateTR();\n");
-  }
-  
+  }  
+  if(IsDetectorOn(kTOF))   fprintf(fp,"\n  new AliTOFv4T0(\"TOF\", \"normal TOF\");\n");
+//central after RICH detectors  
+  if(IsDetectorOn(kMAG))  fprintf(fp,"\n  new AliMAG(\"MAG\",\"Magnet\");\n");  
+  if(IsDetectorOn(kHALL)) fprintf(fp,"\n  new AliHALL(\"HALL\",\"Alice Hall\");\n");
+//forward detectors  
   if(IsDetectorOn(kFMD))   fprintf(fp,"\n  new AliFMDv1(\"FMD\",\"normal FMD\");\n");
+  if(IsDetectorOn(kABSO))  fprintf(fp,"\n  new AliABSOv0(\"ABSO\",\"Muon absorber\");\n");
+  if(IsDetectorOn(kDIPO))  fprintf(fp,"\n  new AliDIPOv2(\"DIPO\",\"Dipole version 2\");\n");
   if(IsDetectorOn(kMUON))  fprintf(fp,"\n  new AliMUONv1(\"MUON\",\"default\");\n");
-  if(IsDetectorOn(kPHOS))  fprintf(fp,"\n  new AliPHOSv1(\"PHOS\",\"IHEP\");\n");
   if(IsDetectorOn(kPMD))   fprintf(fp,"\n  new AliPMDv1(\"PMD\",\"normal PMD\");\n");
   if(IsDetectorOn(kSTART)) fprintf(fp,"\n  new AliSTARTv1(\"START\",\"START Detector\");\n");
+  if(IsDetectorOn(kVZERO)) fprintf(fp,"\n  new AliVZEROv2(\"VZERO\",\"normal VZERO\");\n");
+  if(IsDetectorOn(kZDC))   fprintf(fp,"\n  new AliZDCv2(\"ZDC\",\"normal ZDC\");\n");
+//different phase space detectors  
+  if(IsDetectorOn(kPHOS))  fprintf(fp,"\n  new AliPHOSv1(\"PHOS\",\"IHEP\");\n");
   if(IsDetectorOn(kEMCAL)) fprintf(fp,"\n  new AliEMCALv1(\"EMCAL\",\"G56_2_55_19_104_14\");\n");
   if(IsDetectorOn(kCRT))   fprintf(fp,"\n  new AliCRTv0(\"CRT\",\"normal ACORDE\");\n");
-  if(IsDetectorOn(kVZERO)) fprintf(fp,"\n  new AliVZEROv2(\"VZERO\",\"normal VZERO\");\n");
 
   fprintf(fp,"\n  ::Info(\"RICH private config\",\"Stop\");\n"); 
   fprintf(fp,"}\n");