Flag for feedback photons+minors
authordibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Mar 2007 17:17:40 +0000 (17:17 +0000)
committerdibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 12 Mar 2007 17:17:40 +0000 (17:17 +0000)
HMPID/AliHMPID.cxx
HMPID/AliHMPID.h
HMPID/AliHMPIDCluster.cxx
HMPID/AliHMPIDCluster.h
HMPID/AliHMPIDDigitizer.cxx
HMPID/Hconfig.C
HMPID/Hdisp.C
HMPID/Hqa.C

index b8ac5c7..39be890 100644 (file)
@@ -25,6 +25,9 @@
 #include <AliHeader.h>
 #include <TH1F.h>        //HitQA()
 #include <AliLog.h>      //in many methods to print AliInfo 
+
+Bool_t AliHMPID::fDoFeed=kTRUE;
 ClassImp(AliHMPID)    
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 AliHMPID::AliHMPID(const char *name, const char *title):AliDetector(name,title),fSdi(0),fDig(0),fClu(0)
index dec1e1e..48f16a3 100644 (file)
@@ -27,6 +27,7 @@ public:
           void  MakeBranch      (Option_t *opt="");            //from AliModule invokde from AliRun::Tree2Tree() to make requested HMPID branch
           void  SetTreeAddress  (                );            //from AliModule invoked from AliRun::GetEvent(), AliLoader::SetTAddrInDet()
   virtual void  StepManager     (                )=0;          //from AliModule invoked from AliMC
+          void  DoFeed          (Bool_t doFeed   ){fDoFeed=doFeed;} // Set feedback photons
 //private part +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
   void          HitCreate(         )     {if(fHits)return; fHits=new TClonesArray("AliHMPIDHit"); fNhits=0;     }//create hits list
               
@@ -48,6 +49,7 @@ public:
     fClu=new TObjArray(7); for(Int_t i=0;i<7;i++)fClu->AddAt(new TClonesArray("AliHMPIDCluster"),i);            }//create clusters list
          void   CluReset (         )     {if(fClu)for(int i=0;i<7;i++)fClu->At(i)->Clear();                     }//clean clusters list
 protected:  
+  static  Bool_t fDoFeed;
   TClonesArray         *fSdi;                     //! list of sdigits  
   TObjArray            *fDig;                     //! each chamber holds it's one list of digits
   TObjArray            *fClu;                     //! each chamber holds it's one list of clusters 
index d5a28f8..519ff9f 100644 (file)
@@ -17,6 +17,9 @@
 #include <TMinuit.h>         //Solve()
 #include <TClonesArray.h>    //Solve()
 #include <TMarker.h>         //Draw()
+
+Bool_t AliHMPIDCluster::fDoCorrSin=kTRUE;
+
 ClassImp(AliHMPIDCluster)
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDCluster::CoG()
@@ -46,9 +49,8 @@ void AliHMPIDCluster::CoG()
   fBox=(maxPadX-minPadX+1)*100+maxPadY-minPadY+1;           // dimension of the box: format Xdim*100+Ydim
   
   if ( fQRaw != 0 )   fX/=fQRaw;fY/=fQRaw;                  //final center of gravity
-  
-  if(fDigs->GetEntriesFast()>1)CorrSin();                   //correct it by sinoid   
+   
+  if(fDigs->GetEntriesFast()>1&&fDoCorrSin)CorrSin();       //correct it by sinoid   
   
   fQ  = fQRaw;                                              // Before starting fit procedure, Q and QRaw must be equal
   fCh=pDig->Ch();                                           //initialize chamber number
index 6d190f4..1cabc98 100644 (file)
@@ -36,19 +36,22 @@ public:
          Int_t          Ch       (                                         )const{return fCh;                                    } //chamber number
   inline void           DigAdd   (AliHMPIDDigit *pDig                      );                                                      //add new digit ot the cluster
          AliHMPIDDigit* Dig      (Int_t i                                  )const{return (AliHMPIDDigit*)fDigs->At(i);           } //pointer to i-th digi 
-  inline Bool_t         IsInPc   ();                                                                                        //check if is in the current PC
+  inline Bool_t         IsInPc   ();                                                                                               //check if is in the current PC
   inline void           Reset    (                                         );                                                      //cleans the cluster
          Int_t          Size     (                                         )const{return fSi;                                    } //returns number of pads in formed cluster 
          Int_t          Solve    (TClonesArray *pCluLst,Bool_t isUnfold    );                                                      //solve cluster: MINUIT fit or CoG
-         Int_t          Status  (                                          ) const{return fSt;}                                   //Status of cluster                                  
+         Int_t          Status   (                                         ) const{return fSt;}                                    //Status of cluster                                  
          Double_t       QRaw     (                                         )const{return fQRaw;                                  } //raw cluster charge in QDC channels 
          Double_t       Q        (                                         )const{return fQ;                                     } //given cluster charge in QDC channels 
          Double_t       Qe       (                                         )const{return fErrQ;                                  } //Error in cluster charge in QDC channels 
          Double_t       X        (                                         )const{return fX;                                     } //cluster x position in LRS
          Double_t       Xe       (                                         )const{return fErrX;                                  } //cluster charge in QDC channels 
          Double_t       Y        (                                         )const{return fY;                                     } //cluster y position in LRS 
-         Double_t       Ye       (                                         )const{return fErrY;                                    } //cluster charge in QDC channels 
-         Double_t       Chi2     (                                         )const{return fChi2;                                  } 
+         Double_t       Ye       (                                         )const{return fErrY;                                  } //cluster charge in QDC channels 
+         Double_t       Chi2     (                                         )const{return fChi2;                                  } //chi2 of the fit
+         void           DoCorrSin(Bool_t doCorrSin                         ){fDoCorrSin=doCorrSin;}                                // Set sinoidal correction
+         void           SetX     (Double_t x                               ){fX=x;}                                                // Setter
+         void           SetY     (Double_t y                               ){fY=y;}                                                // Setter
 protected:
   Int_t         fCh;          //chamber number
   Int_t         fSi;          //size of the formed cluster from which this cluster deduced
@@ -66,6 +69,7 @@ protected:
   Double_t      fErrY;        //error on y postion, [cm]
   Double_t      fChi2;        //some estimator of the fit quality
   TObjArray    *fDigs;        //! list of digits forming this cluster
+  static  Bool_t fDoCorrSin;  //
   ClassDef(AliHMPIDCluster,6) //HMPID cluster class
 };//class AliHMPIDCluster
 
index 7eece0d..e159151 100644 (file)
@@ -24,7 +24,7 @@
 
 ClassImp(AliHMPIDDigitizer)
 
-Bool_t AliHMPIDDigitizer::fDoNoise=kTRUE;
+Bool_t AliHMPIDDigitizer::fDoNoise=kFALSE;
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 void AliHMPIDDigitizer::Exec(Option_t*)
 {
index 88477bf..2f34344 100644 (file)
@@ -7,7 +7,7 @@ public:
           HmpConfig(const char*sFileName);
          ~HmpConfig()                    {Info("ctor","");Cleanup();}
          
-  enum EVersOpts  {kNo=101,kVer0,kVer1,kVer2,kTest, kDeclust=301,kSagita,kFeedback,kSecRad,kQe0=400,kQeNorm,kOptics};
+  enum EVersOpts  {kNo=101,kVer0,kVer1,kVer2,kTest, kDeclust=301,kSagita,kFeedback,kElNoise,kQe0=400,kQeNorm,kOptics};
   enum EGenTypes  {kGunZ=1,kGun1,kGun7,kBox,kHijing,kHijingPara,kPythia,kHmpLib,kNotUsed=999};
   
   enum EDetectors {kPIPE=1,kITS,kTPC,kTRD,kTOF,kFRAME,kMAG,kACORDE,kHALL,kPHOS,kT0,kFMD,kABSO,kPMD,kDIPO,kEMCAL,kVZERO,kMUON,kZDC,kSHILD};
@@ -76,12 +76,12 @@ void HmpConfig::GuiHmp(TGHorizontalFrame *pMainHF)
     new TGRadioButton(fVerBG,   "ver1"       ,kVer1     );  fVerBG->SetButton(kVer1);
     new TGRadioButton(fVerBG,   "ver2"       ,kVer2     );
   pHmpGF->AddFrame(fOptBG=new TGButtonGroup(pHmpGF,""));  fOptBG->Connect("Pressed(Int_t)" ,"HmpConfig",this,"HmpVerSlot(Int_t)");
-    new TGCheckButton(fOptBG,"Test beam position?"  ,kTest);       
-    new TGCheckButton(fOptBG,"Second radiator?"     ,kSecRad);       
-    new TGCheckButton(fOptBG,"Decluster?"           ,kDeclust);      fOptBG->SetButton(kDeclust);
-    new TGCheckButton(fOptBG,"Wire sagita?"         ,kSagita);       fOptBG->SetButton(kSagita);
-    new TGCheckButton(fOptBG,"Feedbacks?"           ,kFeedback);     fOptBG->SetButton(kFeedback); 
-    new TGCheckButton(fOptBG,"Plot optics?"         ,kOptics);     
+    new TGCheckButton(fOptBG,"Test run position"   ,kTest);       
+    new TGCheckButton(fOptBG,"Unfold cluster    "  ,kDeclust);      fOptBG->SetButton(kDeclust);
+    new TGCheckButton(fOptBG,"Wire sagitta      "  ,kSagita);       fOptBG->SetButton(kSagita);
+    new TGCheckButton(fOptBG,"Photon feedback   "  ,kFeedback);     fOptBG->SetButton(kFeedback); 
+    new TGCheckButton(fOptBG,"Electronic noise  "  ,kElNoise);     // fOptBG->SetButton(kElNoise); 
+    new TGCheckButton(fOptBG,"Plot optics       "  ,kOptics);     
   pHmpGF->AddFrame(fQeBG=new TGButtonGroup(pHmpGF,""));
     new TGRadioButton(fQeBG,"QE=0"                 ,kQe0);       
     new TGRadioButton(fQeBG,"QE normal"            ,kQeNorm);       fQeBG->SetButton(kQeNorm);
@@ -105,10 +105,11 @@ void HmpConfig::WriteHmp(FILE *pF)
 {
   if(!fVerBG->GetButton(kNo)->GetState()){
     TString title;
-    if( fOptBG->GetButton(kSecRad)->GetState())             title+=" Radiator2 ";
-    if(!fOptBG->GetButton(kSagita)->GetState())             fprintf(pF,"  AliHMPIDParam::fgIsWireSagita=kFALSE;\n");
-    if( fOptBG->GetButton(kTest)  ->GetState())             title+=" TestBeam ";
-    if( fOptBG->GetButton(kOptics)->GetState())             title+=" ShowOptics ";
+    if(!fOptBG->GetButton(kSagita)  ->GetState())             fprintf(pF,"  AliHMPIDParam::fgIsWireSagita=kFALSE;\n");
+    if(!fOptBG->GetButton(kFeedback)->GetState())             fprintf(pF,"  AliHMPIDv1::DoFeed(kFALSE);\n");
+    if( fOptBG->GetButton(kElNoise) ->GetState())             fprintf(pF,"  AliHMPIDDigitizer::DoNoise(kTRUE);\n");
+    if( fOptBG->GetButton(kTest)    ->GetState())             title+=" TestBeam ";
+    if( fOptBG->GetButton(kOptics)  ->GetState())             title+=" ShowOptics ";
     if(title.Length()==0) title="Default";
     
     if     (fVerBG->GetButton(kVer0)->GetState())           fprintf(pF,"  new AliHMPIDv0(\"Gel %s\");\n\n",title.Data());    
index 8f86197..bb21a50 100644 (file)
@@ -49,8 +49,8 @@ void SimEvt()
   TObjArray    digs(7); for(Int_t i=0;i<7;i++) digs.AddAt(new TClonesArray("AliHMPIDDigit"),i);
   TObjArray    clus(7); for(Int_t i=0;i<7;i++) clus.AddAt(new TClonesArray("AliHMPIDCluster"),i);
   AliESD esd;
-  AliHMPIDDigit::fSigmas=3;
-  AliHMPIDDigitizer::DoNoise(kTRUE);
+  AliHMPIDDigit::fSigmas=4;
+  AliHMPIDDigitizer::DoNoise(kFALSE);
   SimEsd(&esd);
   SimHits(&esd,&hits);
              AliHMPIDv1::Hit2Sdi(&hits,&sdig);                               
index a12c34d..e532bb4 100644 (file)
@@ -5,7 +5,10 @@ void Hqa()
 }//Hqa()
 void HitQA()
 {
-  Int_t nEvts=100;
+  TFile *pFile = new TFile("Hqa.root","recreate");
+  AliHMPIDCluster::DoCorrSin(kFALSE);
+  AliHMPIDDigit::fSigmas=4;
+  Int_t nEvts=10000;
   TLegend *lQ=new TLegend(0.5,0.5,0.9,0.9);
 
   TH1F *hQ7eV  =new TH1F("hQ7eV"  ,"" ,300,-50,2000);     hQ7eV  ->SetLineColor(kRed);      lQ->AddEntry(hQ7eV  ,"Ckov 7 eV");  hQ7eV->SetStats(0);
@@ -31,9 +34,11 @@ void HitQA()
   TH2F *pCluMapNot  =new TH2F("cluMapNot","Raw Clusters"     ,1700,-10,160,1700,-10,160);      
   TH2F *pCluMapMax  =new TH2F("cluMapMax","N. locs excceds"  ,1700,-10,160,1700,-10,160);      
 
-  TH1F *hHitCluDifX = new TH1F("hHitCluDifX" ,";entries;x_{Hit}-x_{Clu} [cm]"   ,2000,-2,2);          hHitCluDifX->Sumw2();    hHitCluDifX->SetFillColor(kYellow);
-  TH1F *hHitCluDifY = new TH1F("hHitCluDifY" ,";entries;y_{Hit}-y_{Clu} [cm]"   ,2000,-2,2);          hHitCluDifY->Sumw2();    hHitCluDifY->SetFillColor(kYellow);
-  TH2F *hHitCluDifXY= new TH2F("hHitCluDifXY",";x_{Hit}-x_{Clu};y_{Hit}-y_{Clu}",2000,-2,2,2000,-2,2);hHitCluDifXY->Sumw2();  
+  TH1F *hHitCluDifX = new TH1F("hHitCluDifX" ,";entries;x_{Hit}-x_{Clu} [cm]"   ,1000,-1,1);          hHitCluDifX->Sumw2();    hHitCluDifX->SetFillColor(kYellow);
+//  TH2F *hHitCluDifXv= new TH2F("hHitCluDifXv",";x_{Hit};x_{Hit}-x_{Clu} [cm]"   ,500,-0.5,0.5,1000,-0.2,0.2);hHitCluDifXv->Sumw2();
+  TProfile *hHitCluDifXv= new TProfile("hHitCluDifXv",";x_{Hit};x_{Hit}-x_{Clu} [cm]"   ,500,-0.5,0.5);
+  TH1F *hHitCluDifY = new TH1F("hHitCluDifY" ,";entries;y_{Hit}-y_{Clu} [cm]"   ,1000,-1,1);          hHitCluDifY->Sumw2();    hHitCluDifY->SetFillColor(kYellow);
+  TH2F *hHitCluDifXY= new TH2F("hHitCluDifXY",";x_{Hit}-x_{Clu};y_{Hit}-y_{Clu}",1000,-1,1,1000,-1,1);hHitCluDifXY->Sumw2();  
   TH1F *hHitCluDifQ = new TH1F("hHitCluDifQ" ,";entries;(Q_{Clu}-Q_{Hit})/Q_{Hit}" ,200 ,-200,200);   hHitCluDifQ->Sumw2();    hHitCluDifQ->SetFillColor(kYellow);
   
   TH2F *hHitMap= new TH2F("hHitMap",";x_{Hit};y_{Hit}",1700,-10,160,1700,-10,160);  
@@ -50,14 +55,16 @@ void HitQA()
   
     
   for(Int_t iEvt=0;iEvt<nEvts;iEvt++){//events loop
-    if(iEvt%500==0)Printf("============> iEvt = %d ",iEvt);
+    if(iEvt%50==0)Printf("============> iEvt = %d ",iEvt);
     
     Int_t ch,pid; Float_t e,hitx,hity,hitq;
 //    Int_t nHits=(type==999)?1:40;
     Int_t nHits=1;
     for(Int_t iHit=0;iHit<nHits;iHit++){//hits loop for the current event
       switch(iHit){
-        case 0:  ch=0;pid=kProton;e=e200;hitx=16.0+gRandom->Rndm()*0.8;hity= 16.8+gRandom->Rndm()*0.84;break; //mip ramdomly distributed in one pad in the middle
+        case 0:  ch=0;pid=kProton;e=e200;
+                 hitx=AliHMPIDDigit::SizePadX()*(6+gRandom->Rndm());
+                 hity=AliHMPIDDigit::SizePadY()*(6+gRandom->Rndm());break; //mip ramdomly distributed in one pad
         case 1:  ch=0;pid=kProton;e=e200;hitx=0.4;hity=0.42;break; //mip in left-hand bottom coner of chamber 0
         case 2:  ch=0;pid=kProton;e=e200;hitx=0.4;hity=30  ;break; //mip on left edge of chamber 0
         case 3:  ch=0;pid=kProton;e=e200;hitx=40; hity=0.42;break; //mip on bottom edge of chamber 0
@@ -75,7 +82,7 @@ void HitQA()
     AliHMPIDv1::Hit2Sdi(&hits,&sdigs);
     AliHMPIDDigitizer::DoNoise(kFALSE);
     AliHMPIDDigitizer::Sdi2Dig(&sdigs,&digs);
-    AliHMPIDReconstructor::Dig2Clu(&digs,&clus,kFALSE);
+    AliHMPIDReconstructor::Dig2Clu(&digs,&clus,kTRUE);
 
 // From here normal procedure for QA
 
@@ -113,20 +120,25 @@ void HitQA()
     case       kNoLoc: status="no LocMax(fit)"   ;break;
     case       kAbn  : status="Abnormal fit  "   ;break;
 */
-            case AliHMPIDCluster::kSi1:   pCluMapSi1->Fill(clux,cluy); break;
-            case AliHMPIDCluster::kLo1:   pCluMapLo1->Fill(clux,cluy); break;
-            case AliHMPIDCluster::kUnf:   pCluMapUnf->Fill(clux,cluy); break; 
-            case AliHMPIDCluster::kMax:   pCluMapMax->Fill(clux,cluy); break;
-            case AliHMPIDCluster::kEdg:   pCluMapEdg->Fill(clux,cluy); break;
-            case AliHMPIDCluster::kCoG:   pCluMapCoG->Fill(clux,cluy); break;
-            case AliHMPIDCluster::kNoLoc: pCluMapNoLoc->Fill(clux,cluy); break;
-            case AliHMPIDCluster::kAbn:   pCluMapAbn->Fill(clux,cluy); break;
-            case AliHMPIDCluster::kNot:   pCluMapNot->Fill(clux,cluy); break;
+            case AliHMPIDCluster::kSi1:   pCluMapSi1->Fill(clux,cluy);  break;
+            case AliHMPIDCluster::kLo1:   pCluMapLo1->Fill(clux,cluy);  break;
+            case AliHMPIDCluster::kUnf:   pCluMapUnf->Fill(clux,cluy);  break; 
+            case AliHMPIDCluster::kMax:   pCluMapMax->Fill(clux,cluy);  break;
+            case AliHMPIDCluster::kEdg:   pCluMapEdg->Fill(clux,cluy);  break;
+            case AliHMPIDCluster::kCoG:   pCluMapCoG->Fill(clux,cluy);  break;
+            case AliHMPIDCluster::kNoLoc: pCluMapNoLoc->Fill(clux,cluy);break;
+            case AliHMPIDCluster::kAbn:   pCluMapAbn->Fill(clux,cluy);  break;
+            case AliHMPIDCluster::kNot:   pCluMapNot->Fill(clux,cluy);  break;
             default:     pCluMapEmp->Fill(clux,cluy); break;           
         }
         
         hHitCluDifX->Fill(hitx-clux); hHitCluDifY->Fill(hity-cluy); hHitCluDifXY->Fill(hitx-clux,hity-cluy); hHitCluDifQ->Fill(100*(cluq-hitq)/hitq);
-        
+        // distorsion due to feedback photons
+        Int_t pc,px,py;
+        AliHMPIDDigit::Lors2Pad(hitx,hity,pc,px,py);
+        Float_t padCenterX = AliHMPIDDigit::LorsX(pc,px);
+        if(pClu->Size()>1)hHitCluDifXv->Fill(hitx-padCenterX,(hitx-clux));        
+        //
       }//clusters loop
     }//chambers loop
       
@@ -137,7 +149,17 @@ void HitQA()
   TCanvas *pC2=new TCanvas("Digit canvas","Digit canvas",1280,800); pC2->Divide(3,3);
   pC2->cd(1);hHitCluDifX->Draw("hist");
   pC2->cd(2);hHitCluDifY->Draw("hist");
-  pC2->cd(3);hHitCluDifXY->Draw("colz");
+//  pC2->cd(3);hHitCluDifXY->Draw("colz");
+  // Draw CorrSin
+  AliHMPIDCluster c;
+  TPolyLine *pLine = new TPolyLine(500);
+  for(Int_t i=0;i<500;i++) {
+    Double_t x = 0 + i*AliHMPIDDigit::SizePadX()/500.;
+    c.SetX(x);c.SetY(0);c.CorrSin();
+    pLine->SetPoint(i,x-0.5*AliHMPIDDigit::SizePadX(),c.X()-x);
+  }
+  pC2->cd(3);hHitCluDifXv->Draw("colz");pLine->Draw("C");
+  //
   pC2->cd(4);hHitCluDifQ->Draw("hist");
   pC2->cd(5);gPad->SetLogy(1);hCluFlg->Draw();
   pC2->cd(6);hCluChi2->Draw();
@@ -157,7 +179,8 @@ void HitQA()
    
   pC1->SaveAs("$HOME/HitMaps.png");  //?????
   pC2->SaveAs("$HOME/HitCluDif.gif");  
-  
+
+  pFile->Write();  
   Printf("Digits - raw -digits conversion...");  
   
   AliHMPIDDigit d1,d2; Int_t ddl,r,d,a;UInt_t w32;