]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HMPID/Hmenu.C
Coding conventions
[u/mrichter/AliRoot.git] / HMPID / Hmenu.C
CommitLineData
59280a5a 1AliRun *a; AliRunLoader *al; TGeoManager *g; //globals for easy manual manipulations
2AliHMPID *h; AliLoader *hl; AliHMPIDParam *hp;
594d861b 3Bool_t isGeomType=kFALSE;
4
1d4857c5 5Int_t nCurEvt=0;
6Int_t nMaxEvt=0;
7TControlBar *pMenu=0;
594d861b 8//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
9void GetParam()
10{
11 isGeomType=!isGeomType;
59280a5a 12 if(g) delete g; if(hp) delete hp; //delete current TGeoManager and AliHMPIDParam
594d861b 13 if(isGeomType) g=TGeoManager::Import("geometry.root");
14 else g=TGeoManager::Import("misaligned_geometry.root");
59280a5a 15 hp=AliHMPIDParam::Instance();
d1bf51e1 16}//GetParam()
594d861b 17//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
18void Hmenu()
19{
20 TString status="Status: ";
21 if(gSystem->IsFileInIncludePath("galice.root")){
1d4857c5 22 status+="galice.root: ";
594d861b 23 al=AliRunLoader::Open(); //try to open galice.root from current dir
24 if(gAlice) delete gAlice; //in case we execute this in aliroot delete default AliRun object
25 al->LoadgAlice(); a=al->GetAliRun(); //take new AliRun object from galice.root
59280a5a 26 hl=al->GetDetectorLoader("HMPID"); h=(AliHMPID*)a->GetDetector("HMPID"); //get HMPID object from galice.root
594d861b 27
1d4857c5 28 status+=(h)? "HMPID": "PROBLEM PROBLEM PROBLEM- no HMPID";
29 nMaxEvt=al->GetNumberOfEvents()-1;
30 status+=Form(" Event(s) 0-%i",nMaxEvt);
594d861b 31 }else
1d4857c5 32 status+="PROBLEM PROBLEM PROBLEM no galice.root";
594d861b 33
1d4857c5 34 status+=Form(" curent event %i",nCurEvt);
594d861b 35 GetParam();
1d4857c5 36 pMenu = new TControlBar("horizontal",status.Data(),0,0);
594d861b 37 pMenu->AddButton(" ","","");
d1bf51e1 38 pMenu->AddButton(" General ","General()" ,"general items which do not depend on any files");
594d861b 39 pMenu->AddButton(" ","" ,"");
d1bf51e1 40 pMenu->AddButton(" Sim data ","SimData()" ,"items which expect to have simulated files" );
594d861b 41 pMenu->AddButton(" ","" ,"");
d1bf51e1 42 pMenu->AddButton(" Raw data ","RawData()" ,"items which expect to have raw files" );
b03773cc 43 pMenu->AddButton(" "," " ,"");
d1bf51e1 44 pMenu->AddButton(" Test ","Test()" ,"all test utilities");
b03773cc 45 pMenu->AddButton(" PREV EVENT ","PrevEvent()" ,"Set the previous event" );
46 pMenu->AddButton(" NEXT EVENT ","NextEvent()","Set the next event" );
47 pMenu->AddButton(" Quit ",".q" ,"close session" );
594d861b 48 pMenu->Show();
d1bf51e1 49}//Menu()
594d861b 50//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
51void General()
52{
d1bf51e1 53 TControlBar *pMenu = new TControlBar("vertical","General purpose",100,50);
1d4857c5 54 pMenu->AddButton("Debug ON","don();" ,"Switch debug on-off" );
55 pMenu->AddButton("Debug OFF","doff();" ,"Switch debug on-off" );
59280a5a 56 pMenu->AddButton("Geo GUI","geo();" ,"Shows geometry" );
57 pMenu->AddButton("Browser","new TBrowser;" ,"Start ROOT TBrowser" );
594d861b 58 pMenu->Show();
d1bf51e1 59}//General()
594d861b 60//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
61void SimData()
62{
1d4857c5 63 TControlBar *pSim = new TControlBar("vertical","Sim data",310,50);
64 pSim->AddButton("Display ","hed();" ,"Display Fast");
65 pSim->AddButton("HITS QA" ,"hqa()" ,"QA plots for hits: hqa()");
66 pSim->AddButton("Print stack" ,"stack();" ,"To print hits: hp(evt)");
67 pSim->AddButton("Print hits" ,"hp(nCurEvt);" ,"To print hits: hp(evt)");
68 pSim->AddButton("Print sdigits" ,"sp(nCurEvt);" ,"To print sdigits: sp(evt)");
69 pSim->AddButton("Print digits" ,"dp(nCurEvt);" ,"To print digits: dp(evt)");
70 pSim->AddButton("Print clusters" ,"cp(nCurEvt);" ,"To print clusters: cp(evt)");
71 pSim->Show();
d1bf51e1 72}//SimData()
594d861b 73//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
74void RawData()
75{
d1bf51e1 76 TControlBar *pMenu = new TControlBar("vertical","Raw data",580,50);
594d861b 77 pMenu->AddButton("ESD print" ,"ep();" ,"To print ESD info: ep()" );
78 pMenu->AddButton("ESD QA" ,"eq();" ,"To draw ESD hists: eq()" );
79 pMenu->AddButton("Clusters print" ,"cp();" ,"To print clusters: cp()" );
80 pMenu->AddButton("Clusters QA" ,"cq();" ,"To draw clusters hists: cq()" );
81 pMenu->AddButton("Print Matrix" ,"mp();" ,"To print prob matrix: mp()" );
82 pMenu->AddButton("Print occupancy" ,"r->OccupancyPrint(-1);" ,"To print occupancy" );
83 pMenu->AddButton("Print event summary " ,"r->SummaryOfEvent();" ,"To print a summary of the event" );
84 pMenu->Show();
d1bf51e1 85}//RawData()
594d861b 86//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
87void Test()
88{
1d4857c5 89 TControlBar *pTst = new TControlBar("vertical","Test",625,50);
90 pTst->AddButton("TEST Display " ,"sed();" ,"Display Fast");
91 pTst->AddButton("Test all" ,"tst();" ,"test hits->sdigits->digits" );
92 pTst->AddButton("Segmentation" ,"ts()" ,"test segmentation methods" );
93 pTst->AddButton("Test response" ,"AliHMPIDParam::TestResp();","Test AliHMPIDParam response methods" );
94 pTst->AddButton("Print map" ,"PrintMap();" ,"Test AliHMPIDParam transformation methods" );
95 pTst->AddButton("Test Recon" ,"rec();" ,"Test AliHMPIDRecon" );
96 pTst->Show();
594d861b 97}//Test()
98//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
99
100
101void doff(){ Printf("DebugOFF"); AliLog::SetGlobalDebugLevel(0);}
102void don() { Printf("DebugON"); AliLog::SetGlobalDebugLevel(AliLog::kDebug);}
103
104void geo ( ) {gGeoManager->GetTopVolume()->Draw("ogl");}
105
59280a5a 106void du ( ) {h->Dump ( );} //utility display
594d861b 107
1d4857c5 108void PrevEvent() {nCurEvt--;if(nCurEvt<0 )nCurEvt=0 ;pMenu->SetTitle(Form("Event(s): 0-%i Current event %i",nMaxEvt,nCurEvt));}
109void NextEvent() {nCurEvt++;if(nCurEvt>=nMaxEvt)nCurEvt=nMaxEvt;pMenu->SetTitle(Form("Event(s): 0-%i Current event %i",nMaxEvt,nCurEvt));}
b03773cc 110void stack( ) {AliHMPIDParam::Stack();}
111void tid (Int_t tid,Int_t evt=0) {AliHMPIDParam::Stack(evt,tid);}
594d861b 112//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
594d861b 113void PrintMap()
114{
115
116 Double_t r2d=TMath::RadToDeg();
117
ae5a42aa 118 Double_t x=AliHMPIDParam::SizeAllX(),y=AliHMPIDParam::SizeAllY();
594d861b 119
120 Printf("\n\n\n");
121
122 for(int ch=6;ch>=0;ch--){
1d4857c5 123 AliHMPIDDigit dL,dR; dL.Manual2(ch,2,0 ,24);
124 dR.Manual2(ch,3,79,24);
594d861b 125 TVector3 lt=rp->Lors2Mars(ch,0,y); TVector3 rt=rp->Lors2Mars(ch,x,y);
126 TVector3 ce=rp->Lors2Mars(ch,x/2,y/2);
127 TVector3 lb=rp->Lors2Mars(ch,0,0); TVector3 rb=rp->Lors2Mars(ch,x,0);
128
129 Printf(" ____________________________");
130 Printf("|%6.2fcm %6.2fcm|" ,lt.Mag() , rt.Mag() );
131 Printf("|%6.2fde %6.2fde|" ,lt.Theta()*r2d , rt.Theta()*r2d );
132 Printf("|%6.2fde %6.2fde|" ,lt.Phi()*r2d , rt.Phi()*r2d );
133 Printf("| |" );
134 Printf("|DDL %2i %7.2fcm DDL %2i|" ,dL.DdlIdx() , ce.Mag() , dR.DdlIdx() );
135 Printf("| 0x%x %7.2fdeg 0x%x|" ,dL.DdlId() , ce.Theta()*r2d , dR.DdlId() );
136 Printf("| %7.2fdeg |" , ce.Phi()*r2d );
137 Printf("| |");
138 Printf("|%6.2fcm %6.2fcm|" ,lb.Mag() , rb.Mag() );
139 Printf("|%6.2fde %6.2fde|" ,lb.Theta()*r2d , rb.Theta()*r2d );
140 Printf("|%6.2fde Ch%i %6.2fde|" ,lb.Phi()*r2d , ch , rb.Phi()*r2d );
141 Printf(" ----------------------------");
142 }
143
144 Double_t m[3];
145 for(int i=0;i<1000;i++){
146 Float_t xout=0,xin=gRandom->Rndm()*130.60;
147 Float_t yout=0,yin=gRandom->Rndm()*126.16;
148 Int_t c=gRandom->Rndm()*6;
149 rp->Lors2Mars(c,xin,yin,m);
150 rp->Mars2Lors(c,m,xout,yout);
151 if( (xin-xout) != 0) Printf("Problem in X");
152 if( (yin-yout) != 0) Printf("Problem in Y");
153 }
154
155 Int_t ddl,r,d,a,ch,raw,pc,px,py; AliHMPIDDigit dd;
156
157 ddl=0;raw=0x2214000;r= 8;d=8;a=20;
158 ddl=1;raw=0x2214000;r= 8;d=8;a=20;
159
160
161 ddl=2;raw=0x08d6000;r= 2;d=3;a=22;
162 ddl=3;raw=0x08d6000;r= 2;d=3;a=22;
163
164
165 ddl=6;raw=0x592e000;r=22;d=4;a=46;ch=3;pc=4;px=55;py=5;dd.Raw(ddl,raw);
166 Printf("(ch=%i,pc=%i,x=%2i,y=%2i) ddl=%i raw=0x%h (r=%2i,d=%2i,a=%2i)",
167 ch, pc, px, py, ddl, raw, r, d, a); dd.Print();
168 ddl=7;raw=0x592e000;r=22;d=4;a=46;ch=3;pc=1;
594d861b 169}//PrintMap()
1d4857c5 170
d1bf51e1 171//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
d1bf51e1 172void t1(Int_t case=1)
173{
174 AliHMPIDDigit *d[10]; for(Int_t i=0;i<10;i++) d[i]=new AliHMPIDDigit;
175
176
177 Int_t iNdig;
178
179 if(case==1){
180 iNdig=9;
181
182 d[0]->Manual2(1,2,67,26, 33);
183 d[1]->Manual2(1,2,66,25,431); d[2]->Manual2(1,2,67,25, 21);
184 d[3]->Manual2(1,2,65,24,127); d[4]->Manual2(1,2,66,24, 54); d[5]->Manual2(1,2,67,24, 5);
185 d[6]->Manual2(1,2,65,23, 20); d[7]->Manual2(1,2,66,23, 5); d[8]->Manual2(1,2,67,23, 6);
186 }else if(case==2){
187 iNdig=3;
188 d[0]->Manual2(0,0,36,14, 8);
189 d[1]->Manual2(0,0,36,13, 33); d[2]->Manual2(0,0,37,13, 22);
190 }
191
192 AliHMPIDCluster c;
193 for(int i=0;i<iNdig;i++) c.DigAdd(d[i]); c.Print();
194
195
196 TClonesArray *cl=new TClonesArray("AliHMPIDCluster");
197
198 c.Solve(cl,kTRUE);
199 Printf("");
200
201 cl->Print();
202}//t1()
1d4857c5 203//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
204void hp(Int_t iEvt=0)
205{
206//Prints a list of HMPID hits for a given event. Default is event number 0.
207 Printf("List of HMPID hits for event %i",iEvt);
208 if(al->GetEvent(iEvt)) return;
209 if(hl->LoadHits()) return;
210
211 Int_t iTotHits=0;
212 for(Int_t iPrim=0;iPrim<hl->TreeH()->GetEntries();iPrim++){//prims loop
213 hl->TreeH()->GetEntry(iPrim);
214 h->Hits()->Print();
215 iTotHits+=h->Hits()->GetEntries();
216 }
217 hl->UnloadHits();
218 Printf("totally %i hits for event %i",iTotHits,iEvt);
219}
220//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
221void sp(Int_t iEvt=0)
222{
223//prints a list of HMPID sdigits for a given event
224 Printf("List of HMPID sdigits for event %i",iEvt);
225 if(al->GetEvent(iEvt)) return;
226 if(hl->LoadSDigits()) return;
227
228 hl->TreeS()->GetEntry(0);
229 h->SdiLst()->Print();
230 hl->UnloadSDigits();
231 Printf("totally %i sdigits for event %i",h->SdiLst()->GetEntries(),iEvt);
59280a5a 232}
233//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1d4857c5 234void dp(Int_t iEvt=0)
235{
236//prints a list of HMPID digits for a given event
237 Printf("List of HMPID digits for event %i",iEvt);
238 if(al->GetEvent(iEvt)) return;
239 if(hl->LoadDigits()) return;
240
241 hl->TreeD()->GetEntry(0);
242 h->DigLst()->Print();
243 Int_t totDigs=0;
244 for(Int_t i=0;i<7;i++) {totDigs+=h->DigLst(i)->GetEntries();}
245 hl->UnloadDigits();
246 Printf("totally %i digits for event %i",totDigs,iEvt);
247}
248//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
249void cp(Int_t iEvt=0)
250{//prints a list of HMPID clusters for a given event
251 Printf("List of HMPID clusters for event %i",iEvt);
252 if(al->GetEvent(iEvt)) return;
253 if(hl->LoadRecPoints()) return;
254
255 hl->TreeR()->GetEntry(0);
256 h->CluLst()->Print();
257
258 Int_t iCluCnt=0; for(Int_t iCh=0;iCh<7;iCh++) iCluCnt+=h->CluLst(iCh)->GetEntries();
259
260 hl->UnloadRecPoints();
261 Printf("totally %i clusters for event %i",iCluCnt,iEvt);
262}
263//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++