TCanvas *pAll=0;
AliRunLoader *gAL=0; AliLoader *gHL=0; AliESD *gEsd=0; TTree *gEsdTr=0; AliHMPID *gH=0;
-Int_t gEvt=0; Int_t gMaxEvt=0;
+Int_t gEvt=-1; Int_t gMaxEvt=0;
TObjArray *pNmean;
+
+TChain *pCosCh=new TChain("cosmic"); //clm: Define TChain for cosmic
+TObjArray *pCosDigAll=0; //clm: Define global Digits
+TObjArray *pCosCluAll=0; //clm: Define global Clusters
+Int_t gCosRun=0; //clm: global cosmic event number
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-void Hdisp()
+void Hdisp(Int_t cosRun=44) //clm: Select cosmic file for display
{//display events from files if any in current directory or simulated events
pAll=new TCanvas("all","",1300,900); pAll->Divide(3,3,0,0);
// pAll->ToggleEditor();
pAll->Connect("ProcessedEvent(Int_t,Int_t,Int_t,TObject*)",0,"","DoZoom(Int_t,Int_t,Int_t,TObject*)");
OpenCalib();
- if(gSystem->IsFileInIncludePath("galice.root")){// tries to open session
- if(gAlice) delete gAlice; //in case we execute this in aliroot delete default AliRun object
- gAL=AliRunLoader::Open(); //try to open galice.root from current dir
- gAL->LoadgAlice(); //take new AliRun object from galice.root
- gHL=gAL->GetDetectorLoader("HMPID"); gH=(AliHMPID*)gAL->GetAliRun()->GetDetector("HMPID"); //get HMPID object from galice.root
- gMaxEvt=gAL->GetNumberOfEvents()-1;
- gHL->LoadHits(); gHL->LoadSDigits(); gHL->LoadDigits(); gHL->LoadRecPoints();
+ if(gSystem->IsFileInIncludePath("galice.root")){// tries to open session
+ if(gAlice) delete gAlice; //in case we execute this in aliroot delete default AliRun object
+ gAL=AliRunLoader::Open(); //try to open galice.root from current dir
+ gAL->LoadgAlice(); //take new AliRun object from galice.root
+ gHL=gAL->GetDetectorLoader("HMPID"); gH=(AliHMPID*)gAL->GetAliRun()->GetDetector("HMPID"); //get HMPID object from galice.root
+ gMaxEvt=gAL->GetNumberOfEvents()-1;
+ gHL->LoadHits(); gHL->LoadSDigits(); gHL->LoadDigits(); gHL->LoadRecPoints();
+
+ AliHMPIDTracker::SetFieldMap(gAL->GetAliRun()->Field(),kTRUE);
+
+ TFile *pEsdFl=TFile::Open("AliESDs.root"); gEsdTr=(TTree*) pEsdFl->Get("esdTree"); gEsdTr->SetBranchAddress("ESD", &gEsd);
+ pAll->cd(7); TButton *pBtn=new TButton("Next","ReadEvt()",0,0,0.2,0.1); pBtn->Draw();
+ TButton *pHitBtn=new TButton("Print hits","PrintHits()",0,0.2,0.3,0.3); pHitBtn->Draw();
+ TButton *pSdiBtn=new TButton("Print sdis","PrintSdis()",0,0.4,0.3,0.5); pSdiBtn->Draw();
+ TButton *pDigBtn=new TButton("Print digs","PrintDigs()",0,0.6,0.3,0.7); pDigBtn->Draw();
+ TButton *pCluBtn=new TButton("Print clus","PrintClus()",0,0.8,0.3,0.9); pCluBtn->Draw();
+ ReadEvt();
+ }
+ else if ( gSystem->IsFileInIncludePath(Form("cosmic%d.root",cosRun))){ //clm: Check if cosmic file is in the folder
+ gCosRun=cosRun;
+ pCosCh->Add(Form("cosmic%d.root",gCosRun)); //clm: Add cosmic file to chain
+ pCosCh->SetBranchAddress("Digs",&pCosDigAll); //clm: Set digit branch address
+ pCosCh->SetBranchAddress("Clus",&pCosCluAll); //clm: Set cluster branch address
+ gMaxEvt=pCosCh->GetEntries()-1; //clm: Get number of events from the cosmic chain
+ pAll->cd(7); TButton *pCosBtn=new TButton("Next Cosmic","ReadCosEvt()",0,0,0.3,0.1); pCosBtn->Draw(); //clm: define next button
+ ReadCosEvt(); //clm: Read first cosmic event
+ }
+ else{
+ pAll->cd(7); TButton *pBtn=new TButton("Next","SimEvt()",0,0,0.2,0.1); pBtn->Draw();
+ SimEvt();
+ }
+}
- TFile *pEsdFl=TFile::Open("AliESDs.root"); gEsdTr=(TTree*) pEsdFl->Get("esdTree"); gEsdTr->SetBranchAddress("ESD", &gEsd);
- pAll->cd(7); TButton *pBtn=new TButton("Next","ReadEvt()",0,0,0.2,0.1); pBtn->Draw();
- TButton *pHitBtn=new TButton("Print hits","PrintHits()",0,0.2,0.3,0.3); pHitBtn->Draw();
- TButton *pSdiBtn=new TButton("Print sdis","PrintSdis()",0,0.4,0.3,0.5); pSdiBtn->Draw();
- TButton *pDigBtn=new TButton("Print digs","PrintDigs()",0,0.6,0.3,0.7); pDigBtn->Draw();
- TButton *pCluBtn=new TButton("Print clus","PrintClus()",0,0.8,0.3,0.9); pCluBtn->Draw();
- ReadEvt();
- }else{
- pAll->cd(7); TButton *pBtn=new TButton("Next","SimEvt()",0,0,0.2,0.1); pBtn->Draw();
- SimEvt();
- }
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void ReadCosEvt()
+{// Read curent cosmic event and display it assumes that session is alredy opened
+ if(gEvt>gMaxEvt) gEvt=-1; if(gEvt<-1) gEvt=gMaxEvt; //clm: set event limits
+ gEvt++;
+ pCosCh->GetEntry(gEvt); //clm: read event from chain
+ DrawCosEvt(pCosDigAll,pCosCluAll); //clm: draw cosmic event
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void ReadEvt()
{// Read curent event and display it assumes that session is alredy opened
TClonesArray hits("AliHMPIDHit");
- if(gEvt>gMaxEvt) gEvt=0; if(gEvt<0) gEvt=gMaxEvt;
+ if(gEvt>gMaxEvt) gEvt=-1; if(gEvt<-1) gEvt=gMaxEvt; //clm: set event limits
+ gEvt++;
gEsdTr->GetEntry(gEvt); gAL->GetEvent(gEvt);
ReadHits(&hits); gHL->TreeS()->GetEntry(0); gHL->TreeD()->GetEntry(0); gHL->TreeR()->GetEntry(0);
-
-
+
DrawEvt(&hits,gH->DigLst(),gH->CluLst(),gEsd);
- gEvt++;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void SimEvt()
AliESD esd;
AliHMPIDDigit::fSigmas=4;
AliHMPIDDigitizer::DoNoise(kFALSE);
+ gEvt++;
SimEsd(&esd);
SimHits(&esd,&hits);
AliHMPIDv1::Hit2Sdi(&hits,&sdig);
pAll->cd(3); gPad->Clear(); TLatex txt;txt.DrawLatex(0.2,0.2,Form("Simulated event %i",gEvt));
DrawEvt(&hits,&digs,&clus,&esd);
- gEvt++;
}//SimEvt()
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void SimEsd(AliESD *pEsd)
AliHMPIDRecon rec;
- Int_t hc=0; TVector2 pos;
+ Int_t hc=0;
for(Int_t iTrk=0;iTrk<pEsd->GetNumberOfTracks();iTrk++){//tracks loop
AliESDtrack *pTrk=pEsd->GetTrack(iTrk);
Float_t xRa,yRa;
rec.SetTrack(xRa,yRa,theta,phi);
if(!AliHMPIDDigit::IsInDead(xPc,yPc)) new((*pHits)[hc++]) AliHMPIDHit(ch,200e-9,kProton ,iTrk,xPc,yPc); //mip hit
- /*
- for(int i=0;i<4;i++) {
- Float_t x=gRandom->Rndm()*130;Float_t y=gRandom->Rndm()*126;
- if(!AliHMPIDDigit::IsInDead(x,y)) new((*pHits)[hc++]) AliHMPIDHit(ch,7.5e-9,kFeedback,iTrk,x,y); //bkg hits 4 per track
- }
- */
Int_t nPhots = (Int_t)(20.*TMath::Power(TMath::Sin(ckov),2)/TMath::Power(TMath::Sin(TMath::ACos(1./1.292)),2));
for(int i=0;i<nPhots;i++){
- rec.TracePhot(ckov,gRandom->Rndm()*TMath::TwoPi(),pos);
+ TVector2 pos;
+ pos=rec.TracePhot(ckov,gRandom->Rndm()*TMath::TwoPi());
if(!AliHMPIDDigit::IsInDead(pos.X(),pos.Y())) new((*pHits)[hc++]) AliHMPIDHit(ch,7.5e-9,kCerenkov,iTrk,pos.X(),pos.Y());
} //photon hits
}//tracks loop
if(iCh>=0){TLatex txt; txt.SetTextSize(0.1); txt.DrawLatex(-5,-5,Form("%i",iCh));}
for(Int_t iPc=AliHMPIDDigit::kMinPc;iPc<=AliHMPIDDigit::kMaxPc;iPc++){
- TBox *pBox=new TBox(AliHMPIDDigit::fMinPcX[iPc],AliHMPIDDigit::fMinPcY[iPc],
- AliHMPIDDigit::fMaxPcX[iPc],AliHMPIDDigit::fMaxPcY[iPc]);
+ TBox *pBox=new TBox(AliHMPIDDigit::MinPcX(iPc),AliHMPIDDigit::MinPcY(iPc),
+ AliHMPIDDigit::MaxPcX(iPc),AliHMPIDDigit::MaxPcY(iPc));
pBox->SetFillStyle(0);
pBox->Draw();
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void DrawEvt(TClonesArray *pHitLst,TObjArray *pDigLst,TObjArray *pCluLst,AliESD *pEsd)
{//draws all the objects of current event in given canvas
+
+ AliHMPIDParam *pParam=AliHMPIDParam::Instance();
+
AliHMPIDRecon rec;
TPolyMarker *pTxC[7], *pRin[7]; TMarker *pMip,*pCko,*pFee,*pDig,*pClu;
pMip=new TMarker; pMip->SetMarkerColor(kRed); pMip->SetMarkerStyle(kOpenTriangleUp);
Int_t ch=pTrk->GetHMPIDcluIdx();
if(ch<0) continue; //this track does not hit HMPID
ch/=1000000;
- Float_t th,ph,xPc,yPc; pTrk->GetHMPIDtrk(xPc,yPc,th,ph); //get info on current track
- pTxC[ch]->SetNextPoint(xPc,yPc); //add new intersection point
-
+ Float_t th,ph,xRad,yRad; pTrk->GetHMPIDtrk(xRad,yRad,th,ph);//get info on current track
+//
+//Find again intersection of track with PC--> it is not stored in ESD!
+//
+ Float_t xPc=0,yPc=0; //track intersection point with PC
+ Double_t pMom[3],nCh[3]; pTrk->GetPxPyPz(pMom);pParam->Norm(ch,nCh); pParam->Lors2Mars(ch,0,0,pMom,AliHMPIDParam::kPc); //point & norm for PC
+ if(pTrk->Intersect(pMom,nCh,-AliHMPIDTracker::GetBz())==kTRUE){ //try to intersect track with PC
+ pParam->Mars2Lors (ch,pMom,xPc,yPc); //TRKxPC position
+ pTxC[ch]->SetNextPoint(xPc,yPc);
+ }
+// end of point intersection @ PC
Float_t ckov=pTrk->GetHMPIDsignal(); Float_t err=TMath::Sqrt(pTrk->GetHMPIDchi2());
if(ckov>0){
- Printf("theta %f phi %f ckov %f",th*TMath::RadToDeg(),ph*TMath::RadToDeg(),ckov);
- rec.SetTrack(xPc,yPc,th,ph+TMath::Pi());
- TVector2 pos;
- Double_t allGapz=rec.fgkWinThick+0.5*rec.fgkRadThick+rec.fgkGapThick; //to semplify, the (x,y) are calculted from (xPc,yPc) back to radiator in straight line (Bz=0)
- TVector3 dir(0,0,-1);TVector3 miprad(xPc,yPc,allGapz);
- AliHMPIDRecon::Propagate(dir,miprad,0);
- Double_t xRad=miprad.X();
- Double_t yRad=miprad.Y();
- for(int j=0;j<100;j++){
- rec.TracePhot(xRad,yRad,ckov,j*0.0628,pos);
+// Printf("theta %f phi %f ckov %f",th*TMath::RadToDeg(),ph*TMath::RadToDeg(),ckov);
+ rec.SetTrack(xRad,yRad,th,ph);
+ for(Int_t j=0;j<100;j++){
+ TVector2 pos;
+ pos=rec.TracePhot(ckov,j*0.0628);
if(!AliHMPIDDigit::IsInDead(pos.X(),pos.Y())) pRin[ch]->SetNextPoint(pos.X(),pos.Y());
}
}
pLeg->Draw();
}//DrawEvt()
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+void DrawCosEvt(TObjArray *pCosDigLst,TObjArray *pCosCluLst) //clm: new method to read and display cosmic events
+{//draws all the objects of current event in given canvas
+ TMarker *pDig,*pClu;
+ pDig=new TMarker; pDig->SetMarkerColor(kGreen);pDig->SetMarkerStyle(kOpenSquare);
+ pClu=new TMarker; pClu->SetMarkerColor(kBlue); pClu->SetMarkerStyle(kStar);
+
+
+ Int_t totDig=0,totClu=0;
+ for(Int_t iCh=0;iCh<7;iCh++){//chambers loop //clm: chambers loop is now not needed since iCh=0 but kept for provision
+ totDig+=((TClonesArray*)pCosDigLst->At(iCh))->GetEntriesFast();
+ totClu+=((TClonesArray*)pCosCluLst->At(iCh))->GetEntriesFast();
+
+ switch(iCh){
+ case 6: pAll->cd(1); break; case 5: pAll->cd(2); break;
+ case 4: pAll->cd(4); break; case 3: pAll->cd(5); break; case 2: pAll->cd(6); break;
+ case 1: pAll->cd(8); break; case 0: pAll->cd(9); break;
+ }
+ gPad->SetEditable(kTRUE); gPad->Clear();
+ DrawCh(iCh);
+ if(gCosRun < 500 && iCh == 6) { //clm: hard coded selection since raw data does not contain ch info which is set to 0
+ ((TClonesArray*)pCosDigLst->At(0))->Draw(); //draw digits
+ ((TClonesArray*)pCosCluLst->At(0))->Draw(); //draw clusters
+ }
+ if (gCosRun >= 500 && iCh == 5) {
+ ((TClonesArray*)pCosDigLst->At(0))->Draw(); //draw digits
+ ((TClonesArray*)pCosCluLst->At(0))->Draw(); //draw clusters
+ }
+
+ gPad->SetEditable(kFALSE);
+ }//chambers loop
+ pAll->cd(3); gPad->Clear(); TLegend *pLeg=new TLegend(0.2,0.2,0.8,0.8);
+ pLeg->SetHeader(Form("Cosmic Run %i Event %i Total %i",gCosRun,gEvt,gMaxEvt+1));
+ pLeg->AddEntry(pDig ,Form("Digs %i" ,totDig),"p");
+ pLeg->AddEntry(pClu ,Form("Clus %i" ,totClu),"p");
+ pLeg->Draw();
+}//DrawCosEvt()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void DoZoom(Int_t evt, Int_t px, Int_t py, TObject *obj)
{
if(evt!=5 && evt!=6) return; //5- zoom in 6-zoom out