]>
Commit | Line | Data |
---|---|---|
813e97e8 | 1 | #if !defined(__CINT__) || defined(__MAKECINT__) |
569a17d8 | 2 | |
88cb7938 | 3 | #include<Riostream.h> |
569a17d8 | 4 | |
af8e1c2d | 5 | #include<TROOT.h> |
569a17d8 | 6 | |
af8e1c2d | 7 | #include<TArrayI.h> |
569a17d8 | 8 | |
813e97e8 | 9 | #include<TBranch.h> |
569a17d8 | 10 | |
af8e1c2d | 11 | #include<TCanvas.h> |
569a17d8 | 12 | |
af8e1c2d | 13 | #include<TClassTable.h> |
569a17d8 | 14 | |
af8e1c2d | 15 | #include<TClonesArray.h> |
569a17d8 | 16 | |
af8e1c2d | 17 | #include<TFile.h> |
569a17d8 | 18 | |
af8e1c2d | 19 | #include<TH1.h> |
569a17d8 | 20 | |
af8e1c2d | 21 | #include<TH2.h> |
569a17d8 | 22 | |
a6c9fb45 | 23 | #include <TInterpreter.h> |
569a17d8 | 24 | |
af8e1c2d | 25 | #include<TObject.h> |
569a17d8 | 26 | |
af8e1c2d | 27 | #include<TObjArray.h> |
569a17d8 | 28 | |
af8e1c2d | 29 | #include<TTree.h> |
569a17d8 | 30 | |
31 | #include "AliRun.h" | |
32 | ||
33 | #include "AliITS.h" | |
34 | ||
35 | #include "AliITSgeom.h" | |
36 | ||
37 | #include "AliITSDetTypeRec.h" | |
38 | ||
39 | #include "AliITSRecPoint.h" | |
40 | ||
41 | #include "AliITSRecPoint.h" | |
42 | ||
43 | #include "AliITSdigit.h" | |
44 | ||
45 | #include "AliITSdigitSSD.h" | |
46 | ||
47 | #include "AliITShit.h" | |
48 | ||
49 | #include "AliITSmodule.h" | |
50 | ||
51 | #include "AliITSsegmentation.h" | |
52 | ||
53 | #include "AliITSsegmentationSPD.h" | |
54 | ||
55 | #include "AliITSsegmentationSDD.h" | |
56 | ||
57 | #include "AliITSsegmentationSSD.h" | |
58 | ||
59 | #include "AliRunLoader.h" | |
60 | ||
61 | #include "AliITSLoader.h" | |
62 | ||
63 | #include "AliHeader.h" | |
64 | ||
af8e1c2d | 65 | #endif |
569a17d8 | 66 | |
813e97e8 | 67 | void GetHitsCoor(TObject *its, Int_t mod, TObjArray & histos, Int_t subd,Bool_t verb); |
569a17d8 | 68 | |
813e97e8 | 69 | Int_t GetRecCoor(TObject *ge, TClonesArray *ITSrec, Int_t mod, TH2F *h2, TH1F *h1, Bool_t verb); |
569a17d8 | 70 | |
a6c9fb45 | 71 | Int_t GetClusCoor(TObject *ge, TClonesArray *ITSrec, Int_t mod, TH2F *h2, TH1F *h1, Bool_t verb); |
569a17d8 | 72 | |
813e97e8 | 73 | void GetDigits(TObject *tmps,TObject *ge,TClonesArray *ITSdigits, Int_t subd, Int_t mod, Bool_t verbose, TObjArray & histos); |
74 | ||
569a17d8 | 75 | |
76 | ||
7d62fb64 | 77 | Int_t AliITSGeoPlot (Int_t evesel=0, char *opt="All+ClustersV2", char *filename="galice.root", Int_t isfastpoints = 0) { |
569a17d8 | 78 | |
af8e1c2d | 79 | /******************************************************************* |
569a17d8 | 80 | |
af8e1c2d | 81 | * This macro displays geometrical information related to the |
569a17d8 | 82 | |
a6c9fb45 | 83 | * hits, digits and rec points (or V2 clusters) in ITS. |
569a17d8 | 84 | |
af8e1c2d | 85 | * There are histograms that are not displayed (i.e. energy |
569a17d8 | 86 | |
af8e1c2d | 87 | * deposition) but that are saved onto a file (see below) |
569a17d8 | 88 | |
af8e1c2d | 89 | * |
569a17d8 | 90 | |
813e97e8 | 91 | * INPUT arguments: |
569a17d8 | 92 | |
813e97e8 | 93 | * |
569a17d8 | 94 | |
813e97e8 | 95 | * Int_t evesel: the selected event number. It's =0 by default |
569a17d8 | 96 | |
813e97e8 | 97 | * |
569a17d8 | 98 | |
af8e1c2d | 99 | * Options: Any combination of: |
569a17d8 | 100 | |
af8e1c2d | 101 | * 1) subdetector name: "SPD", "SDD", "SSD", "All" (default) |
569a17d8 | 102 | |
af8e1c2d | 103 | * 2) Printouts: "Verbose" Almost everything is printed out: |
569a17d8 | 104 | |
af8e1c2d | 105 | * it is wise to redirect the output onto a file |
569a17d8 | 106 | |
813e97e8 | 107 | * e.g.: .x AliITSGeoPlot.C("All+Verbose") > out.log |
569a17d8 | 108 | |
af8e1c2d | 109 | * 3) Rec Points option: "Rec" ---> Uses Rec. Points (default) |
569a17d8 | 110 | |
a6c9fb45 | 111 | * |
569a17d8 | 112 | |
a6c9fb45 | 113 | * 4) ClustersV2 option: "ClustersV2" ---->Uses ClustersV2 |
569a17d8 | 114 | |
a6c9fb45 | 115 | * otherwise ---->uses hits and digits only |
569a17d8 | 116 | |
af8e1c2d | 117 | * Examples: |
569a17d8 | 118 | |
813e97e8 | 119 | * .x AliITSGeoPlot(); (All subdetectors; no-verbose; no-recpoints) |
569a17d8 | 120 | |
813e97e8 | 121 | * .x AliITSGeoPlot("SPD+SSD+Verbose+Rec"); |
569a17d8 | 122 | |
813e97e8 | 123 | * |
569a17d8 | 124 | |
88cb7938 | 125 | * filename: It's "galice.root" by default. |
569a17d8 | 126 | |
813e97e8 | 127 | * isfastpoints: integer. It is set to 0 by defaults. This means that |
569a17d8 | 128 | |
813e97e8 | 129 | * slow reconstruction is assumed. If fast recpoint are in |
569a17d8 | 130 | |
813e97e8 | 131 | * in use, isfastpoints must be set =1. |
569a17d8 | 132 | |
af8e1c2d | 133 | * |
569a17d8 | 134 | |
af8e1c2d | 135 | * OUTPUT: It produces a root file with a list of histograms |
569a17d8 | 136 | |
813e97e8 | 137 | * |
569a17d8 | 138 | |
af8e1c2d | 139 | * WARNING: spatial information for SSD/DIGITS is obtained by pairing |
569a17d8 | 140 | |
af8e1c2d | 141 | * digits on p and n side originating from the same track, when |
569a17d8 | 142 | |
af8e1c2d | 143 | * possible. This (mis)use of DIGITS is tolerated for debugging |
569a17d8 | 144 | |
af8e1c2d | 145 | * purposes only !!!! The pairing in real life should be done |
569a17d8 | 146 | |
af8e1c2d | 147 | * starting from info really available... |
569a17d8 | 148 | |
af8e1c2d | 149 | * |
569a17d8 | 150 | |
af8e1c2d | 151 | * COMPILATION: this macro can be compiled. |
569a17d8 | 152 | |
813e97e8 | 153 | * 1) You need to set your include path with |
569a17d8 | 154 | |
af8e1c2d | 155 | * gSystem->SetIncludePath("-I- -I$ALICE_ROOT/include -I$ALICE_ROOT/ITS -g"); |
569a17d8 | 156 | |
af8e1c2d | 157 | * 3) If you are using root instead of aliroot you need to |
569a17d8 | 158 | |
af8e1c2d | 159 | * execute the macro loadlibs.C in advance |
569a17d8 | 160 | |
af8e1c2d | 161 | * 4) To compile this macro from root (or aliroot): |
569a17d8 | 162 | |
813e97e8 | 163 | * --- .L AliITSGeoPlot.C++ |
569a17d8 | 164 | |
813e97e8 | 165 | * --- AliITSGeoPlot(); |
569a17d8 | 166 | |
af8e1c2d | 167 | * |
569a17d8 | 168 | |
af8e1c2d | 169 | * M.Masera 14/05/2001 18:30 |
569a17d8 | 170 | |
a6c9fb45 | 171 | * Last rev. 31/05/2004 14:00 (Clusters V2 added) E.C. |
569a17d8 | 172 | |
af8e1c2d | 173 | ********************************************************************/ |
174 | ||
569a17d8 | 175 | |
176 | ||
af8e1c2d | 177 | //Options |
569a17d8 | 178 | |
af8e1c2d | 179 | TString choice(opt); |
569a17d8 | 180 | |
af8e1c2d | 181 | Bool_t All = choice.Contains("All"); |
569a17d8 | 182 | |
af8e1c2d | 183 | Bool_t verbose=choice.Contains("Verbose"); |
569a17d8 | 184 | |
af8e1c2d | 185 | Bool_t userec=choice.Contains("Rec"); |
569a17d8 | 186 | |
a6c9fb45 | 187 | Bool_t useclustersv2=choice.Contains("ClustersV2"); |
569a17d8 | 188 | |
af8e1c2d | 189 | Int_t retcode=1; //return code |
569a17d8 | 190 | |
a6c9fb45 | 191 | |
569a17d8 | 192 | |
af8e1c2d | 193 | if (gClassTable->GetID("AliRun") < 0) { |
569a17d8 | 194 | |
a6c9fb45 | 195 | gInterpreter->ExecuteMacro("loadlibs.C"); |
569a17d8 | 196 | |
af8e1c2d | 197 | } |
569a17d8 | 198 | |
a6c9fb45 | 199 | else { |
569a17d8 | 200 | |
af8e1c2d | 201 | if(gAlice){ |
569a17d8 | 202 | |
88cb7938 | 203 | delete gAlice->GetRunLoader(); |
569a17d8 | 204 | |
af8e1c2d | 205 | delete gAlice; |
569a17d8 | 206 | |
af8e1c2d | 207 | gAlice=0; |
569a17d8 | 208 | |
af8e1c2d | 209 | } |
569a17d8 | 210 | |
af8e1c2d | 211 | } |
569a17d8 | 212 | |
a6c9fb45 | 213 | |
569a17d8 | 214 | |
a6c9fb45 | 215 | AliRunLoader* rl = AliRunLoader::Open(filename); |
569a17d8 | 216 | |
a6c9fb45 | 217 | if (rl == 0x0){ |
569a17d8 | 218 | |
a6c9fb45 | 219 | cerr<<"AliITSGeoPlot.C : Can not open session RL=NULL"<< endl; |
569a17d8 | 220 | |
a6c9fb45 | 221 | return -1; |
569a17d8 | 222 | |
a6c9fb45 | 223 | } |
569a17d8 | 224 | |
a6c9fb45 | 225 | Int_t retval = rl->LoadgAlice(); |
569a17d8 | 226 | |
a6c9fb45 | 227 | if (retval){ |
569a17d8 | 228 | |
a6c9fb45 | 229 | cerr<<"AliITSGeoPlot.C : LoadgAlice returned error"<<endl; |
569a17d8 | 230 | |
a6c9fb45 | 231 | return -1; |
569a17d8 | 232 | |
a6c9fb45 | 233 | } |
569a17d8 | 234 | |
a6c9fb45 | 235 | gAlice=rl->GetAliRun(); |
88cb7938 | 236 | |
569a17d8 | 237 | |
238 | ||
a6c9fb45 | 239 | retval = rl->LoadHeader(); |
569a17d8 | 240 | |
a6c9fb45 | 241 | if (retval){ |
569a17d8 | 242 | |
a6c9fb45 | 243 | cerr<<"AliITSGeoPlot.C : LoadHeader returned error"<<endl; |
569a17d8 | 244 | |
a6c9fb45 | 245 | return -1; |
569a17d8 | 246 | |
a6c9fb45 | 247 | } |
88cb7938 | 248 | |
569a17d8 | 249 | |
250 | ||
a6c9fb45 | 251 | AliITSLoader* ITSloader = (AliITSLoader*) rl->GetLoader("ITSLoader"); |
88cb7938 | 252 | |
569a17d8 | 253 | |
254 | ||
a6c9fb45 | 255 | if(!ITSloader){ |
569a17d8 | 256 | |
a6c9fb45 | 257 | cerr<<"AliITSGeoPlot.C : ITS loader not found"<<endl; |
569a17d8 | 258 | |
a6c9fb45 | 259 | return -1; |
569a17d8 | 260 | |
a6c9fb45 | 261 | } |
88cb7938 | 262 | |
569a17d8 | 263 | |
264 | ||
a6c9fb45 | 265 | ITSloader->LoadHits("read"); |
569a17d8 | 266 | |
a6c9fb45 | 267 | ITSloader->LoadDigits("read"); |
569a17d8 | 268 | |
a6c9fb45 | 269 | if(isfastpoints==1)ITSloader->SetRecPointsFileName("ITS.FastRecPoints.root"); |
569a17d8 | 270 | |
a6c9fb45 | 271 | ITSloader->LoadRecPoints("read"); |
569a17d8 | 272 | |
a6c9fb45 | 273 | rl->GetEvent(evesel); |
569a17d8 | 274 | |
a6c9fb45 | 275 | Int_t nparticles = rl->GetHeader()->GetNtrack(); |
569a17d8 | 276 | |
a6c9fb45 | 277 | AliITS *ITS = (AliITS*)gAlice->GetModule("ITS"); |
569a17d8 | 278 | |
a6c9fb45 | 279 | ITS->SetTreeAddress(); |
569a17d8 | 280 | |
af8e1c2d | 281 | if(verbose) { |
569a17d8 | 282 | |
af8e1c2d | 283 | cout<<" "<<endl<<" "<<endl; |
569a17d8 | 284 | |
af8e1c2d | 285 | cout<<"******* Event processing started *******"<<endl; |
569a17d8 | 286 | |
af8e1c2d | 287 | cout<<"In the following, hits with 'StatusEntering' flag active"<<endl; |
569a17d8 | 288 | |
af8e1c2d | 289 | cout<<"will not be processed"<<endl; |
569a17d8 | 290 | |
af8e1c2d | 291 | cout << "Number of particles= " << nparticles <<endl; |
569a17d8 | 292 | |
af8e1c2d | 293 | } |
294 | ||
569a17d8 | 295 | |
296 | ||
af8e1c2d | 297 | // HITS |
569a17d8 | 298 | |
88cb7938 | 299 | TTree *TH = ITSloader->TreeH(); |
569a17d8 | 300 | |
af8e1c2d | 301 | Stat_t ntracks = TH->GetEntries(); |
569a17d8 | 302 | |
af8e1c2d | 303 | if(verbose)cout<<"Number of primary tracks= "<<ntracks<<endl; |
304 | ||
569a17d8 | 305 | |
306 | ||
af8e1c2d | 307 | // ITS |
569a17d8 | 308 | |
af8e1c2d | 309 | Int_t nmodules; |
569a17d8 | 310 | |
af8e1c2d | 311 | ITS->InitModules(-1,nmodules); |
569a17d8 | 312 | |
af8e1c2d | 313 | cout<<"Number of ITS modules= "<<nmodules<<endl; |
569a17d8 | 314 | |
af8e1c2d | 315 | cout<<"Filling modules... It takes a while, now. Please be patient"<<endl; |
569a17d8 | 316 | |
af8e1c2d | 317 | ITS->FillModules(0,0,nmodules," "," "); |
569a17d8 | 318 | |
af8e1c2d | 319 | cout<<"ITS modules .... DONE!"<<endl; |
569a17d8 | 320 | |
7d62fb64 | 321 | |
569a17d8 | 322 | |
323 | AliITSDetTypeRec* detTypeRec = new AliITSDetTypeRec(ITSloader); | |
324 | ||
7d62fb64 | 325 | detTypeRec->SetDefaults(); |
569a17d8 | 326 | |
af8e1c2d | 327 | // DIGITS |
569a17d8 | 328 | |
88cb7938 | 329 | TTree *TD = ITSloader->TreeD(); |
af8e1c2d | 330 | |
569a17d8 | 331 | |
332 | ||
a6c9fb45 | 333 | //RECPOINTS (V2 clusters) |
569a17d8 | 334 | |
88cb7938 | 335 | TTree *TR = ITSloader->TreeR(); |
569a17d8 | 336 | |
7d62fb64 | 337 | TClonesArray *ITSrec = detTypeRec->RecPoints(); |
569a17d8 | 338 | |
813e97e8 | 339 | TBranch *branch = 0; |
569a17d8 | 340 | |
813e97e8 | 341 | if(userec && TR && ITSrec){ |
569a17d8 | 342 | |
813e97e8 | 343 | if(isfastpoints==1){ |
569a17d8 | 344 | |
88cb7938 | 345 | branch = ITSloader->TreeR()->GetBranch("ITSRecPointsF"); |
569a17d8 | 346 | |
813e97e8 | 347 | cout<<"using fast points\n"; |
569a17d8 | 348 | |
813e97e8 | 349 | } |
569a17d8 | 350 | |
813e97e8 | 351 | else { |
569a17d8 | 352 | |
88cb7938 | 353 | branch = ITSloader->TreeR()->GetBranch("ITSRecPoints"); |
569a17d8 | 354 | |
813e97e8 | 355 | } |
569a17d8 | 356 | |
813e97e8 | 357 | if(branch)branch->SetAddress(&ITSrec); |
569a17d8 | 358 | |
813e97e8 | 359 | } |
360 | ||
569a17d8 | 361 | |
362 | ||
813e97e8 | 363 | if(userec && (!TR || !ITSrec || !branch)){ |
569a17d8 | 364 | |
af8e1c2d | 365 | userec = kFALSE; |
569a17d8 | 366 | |
813e97e8 | 367 | cout<<"\n ======================================================= \n"; |
569a17d8 | 368 | |
813e97e8 | 369 | cout<<"WARNING: there are no RECPOINTS on this file ! \n"; |
569a17d8 | 370 | |
813e97e8 | 371 | cout<<"======================================================= \n \n"; |
569a17d8 | 372 | |
af8e1c2d | 373 | } |
569a17d8 | 374 | |
00a7cc50 | 375 | if(useclustersv2 && TR && ITSrec){ |
569a17d8 | 376 | |
00a7cc50 | 377 | branch = ITSloader->TreeR()->GetBranch("ITSRecPoints"); |
569a17d8 | 378 | |
00a7cc50 | 379 | if(branch)branch->SetAddress(&ITSrec); |
569a17d8 | 380 | |
a6c9fb45 | 381 | } |
382 | ||
569a17d8 | 383 | |
384 | ||
a6c9fb45 | 385 | if(useclustersv2 && (!TR || !ITSrec || !branch)){ |
569a17d8 | 386 | |
a6c9fb45 | 387 | useclustersv2 = kFALSE; |
569a17d8 | 388 | |
a6c9fb45 | 389 | cout<<"\n ======================================================= \n"; |
569a17d8 | 390 | |
a6c9fb45 | 391 | cout<<"WARNING: there are no CLUSTERSV2 on this file ! \n"; |
569a17d8 | 392 | |
a6c9fb45 | 393 | cout<<"======================================================= \n \n"; |
569a17d8 | 394 | |
a6c9fb45 | 395 | } |
396 | ||
813e97e8 | 397 | |
569a17d8 | 398 | |
399 | ||
400 | ||
af8e1c2d | 401 | //local variables |
569a17d8 | 402 | |
af8e1c2d | 403 | Int_t mod; //module number |
569a17d8 | 404 | |
af8e1c2d | 405 | Int_t nbytes = 0; |
569a17d8 | 406 | |
af8e1c2d | 407 | Double_t pos[3]; // Global position of the current module |
569a17d8 | 408 | |
af8e1c2d | 409 | Float_t ragdet; // Radius of detector (x y plane) |
569a17d8 | 410 | |
af8e1c2d | 411 | Int_t first; // first module |
569a17d8 | 412 | |
af8e1c2d | 413 | Int_t last; // last module |
569a17d8 | 414 | |
af8e1c2d | 415 | Int_t nrecp; //number of RecPoints for a given module |
416 | ||
569a17d8 | 417 | |
418 | ||
af8e1c2d | 419 | //List of histograms |
569a17d8 | 420 | |
af8e1c2d | 421 | TObjArray histos(26,0); // contains the pointers to the histograms |
569a17d8 | 422 | |
af8e1c2d | 423 | // Book histograms SPD |
569a17d8 | 424 | |
af8e1c2d | 425 | TH2F *rspd = new TH2F("rspd","Radii of digits - SPD",50,-10.,10.,50,-10.,10.); |
569a17d8 | 426 | |
af8e1c2d | 427 | TH2F *rhspd = new TH2F("rhspd","Radii of hits - SPD",50,-10.,10.,50,-10.,10.); |
569a17d8 | 428 | |
af8e1c2d | 429 | TH2F *rmspd = new TH2F("rmspd","Radii of SPD modules",50,-10.,10.,50,-10.,10.); |
569a17d8 | 430 | |
af8e1c2d | 431 | TH1F *zspd = new TH1F("zspd","Z of digits - SPD",100,-30.,30.); |
569a17d8 | 432 | |
af8e1c2d | 433 | TH1F *zhspd = new TH1F("zhspd","Z of hits - SPD",100,-30.,30.); |
569a17d8 | 434 | |
af8e1c2d | 435 | TH1F *zmspd = new TH1F("zmspd","Z of SPD modules",100,-30,30.); |
a6c9fb45 | 436 | |
569a17d8 | 437 | |
438 | ||
a6c9fb45 | 439 | Char_t title1[50]=""; |
569a17d8 | 440 | |
a6c9fb45 | 441 | Char_t title2[50]=""; |
569a17d8 | 442 | |
a6c9fb45 | 443 | if(userec){ |
569a17d8 | 444 | |
a6c9fb45 | 445 | sprintf(title1,"Radii of recpoints - %s","SPD"); |
569a17d8 | 446 | |
a6c9fb45 | 447 | sprintf(title2,"Z of recpoints - %s","SPD"); |
569a17d8 | 448 | |
a6c9fb45 | 449 | } |
569a17d8 | 450 | |
a6c9fb45 | 451 | if(useclustersv2){ |
569a17d8 | 452 | |
a6c9fb45 | 453 | sprintf(title1,"Radii of clustersV2 - %s","SPD"); |
569a17d8 | 454 | |
a6c9fb45 | 455 | sprintf(title2,"Z of clustersV2 - %s","SPD"); |
569a17d8 | 456 | |
a6c9fb45 | 457 | } |
569a17d8 | 458 | |
a6c9fb45 | 459 | TH2F *rrspd = new TH2F("rrspd",title1,50,-10.,10.,50,-10.,10.); |
569a17d8 | 460 | |
a6c9fb45 | 461 | TH1F *zrspd = new TH1F("zrspd",title2,100,-30.,30.); |
569a17d8 | 462 | |
af8e1c2d | 463 | TH1F *enespd = new TH1F("enespd","Energy deposition SPD (KeV)",100,0.,1000.); |
569a17d8 | 464 | |
af8e1c2d | 465 | histos.AddLast(rspd); // 0 |
569a17d8 | 466 | |
af8e1c2d | 467 | histos.AddLast(rhspd); // 1 |
569a17d8 | 468 | |
af8e1c2d | 469 | histos.AddLast(rmspd); // 2 |
569a17d8 | 470 | |
af8e1c2d | 471 | histos.AddLast(zspd); // 3 |
569a17d8 | 472 | |
af8e1c2d | 473 | histos.AddLast(zhspd); // 4 |
569a17d8 | 474 | |
af8e1c2d | 475 | histos.AddLast(zmspd); // 5 |
569a17d8 | 476 | |
af8e1c2d | 477 | histos.AddLast(rrspd); // 6 |
569a17d8 | 478 | |
af8e1c2d | 479 | histos.AddLast(zrspd); // 7 |
569a17d8 | 480 | |
af8e1c2d | 481 | histos.AddLast(enespd); // 8 |
569a17d8 | 482 | |
af8e1c2d | 483 | // Book histograms SDD |
569a17d8 | 484 | |
af8e1c2d | 485 | TH2F *rsdd = new TH2F("rsdd","Radii of digits - SDD",50,-40.,40.,50,-40.,40.); |
569a17d8 | 486 | |
af8e1c2d | 487 | TH2F *rhsdd = new TH2F("rhsdd","Radii of hits - SDD",50,-40.,40.,50,-40.,40.); |
569a17d8 | 488 | |
af8e1c2d | 489 | TH2F *rmsdd = new TH2F("rmsdd","Radii of SDD modules",50,-40.,40.,50,-40.,40.); |
569a17d8 | 490 | |
af8e1c2d | 491 | TH1F *zsdd = new TH1F("zsdd","Z of digits - SDD",100,-40.,40.); |
569a17d8 | 492 | |
af8e1c2d | 493 | TH1F *zhsdd = new TH1F("zhsdd","Z of hits - SDD",100,-40.,40.); |
569a17d8 | 494 | |
af8e1c2d | 495 | TH1F *zmsdd = new TH1F("zmsdd","Z of SDD modules",100,-40,40.); |
569a17d8 | 496 | |
a6c9fb45 | 497 | Char_t title3[50]; |
569a17d8 | 498 | |
a6c9fb45 | 499 | Char_t title4[50]; |
569a17d8 | 500 | |
a6c9fb45 | 501 | if(userec){ |
569a17d8 | 502 | |
a6c9fb45 | 503 | sprintf(title3,"Radii of recpoints - %s","SDD"); |
569a17d8 | 504 | |
a6c9fb45 | 505 | sprintf(title4,"Z of recpoints - %s","SDD"); |
569a17d8 | 506 | |
a6c9fb45 | 507 | } |
569a17d8 | 508 | |
a6c9fb45 | 509 | if(useclustersv2){ |
569a17d8 | 510 | |
a6c9fb45 | 511 | sprintf(title3,"Radii of clustersV2 - %s","SDD"); |
569a17d8 | 512 | |
a6c9fb45 | 513 | sprintf(title4,"Z of clustersV2 - %s","SDD"); |
569a17d8 | 514 | |
a6c9fb45 | 515 | } |
569a17d8 | 516 | |
a6c9fb45 | 517 | TH2F *rrsdd = new TH2F("rrsdd",title3,50,-40.,40.,50,-40.,40.); |
569a17d8 | 518 | |
a6c9fb45 | 519 | TH1F *zrsdd = new TH1F("zrsdd",title4,100,-40.,40.); |
569a17d8 | 520 | |
af8e1c2d | 521 | TH1F *enesdd = new TH1F("enesdd","Energy deposition SDD (KeV)",100,0.,1000.); |
569a17d8 | 522 | |
af8e1c2d | 523 | histos.AddLast(rsdd); // 9 |
569a17d8 | 524 | |
af8e1c2d | 525 | histos.AddLast(rhsdd); // 10 |
569a17d8 | 526 | |
af8e1c2d | 527 | histos.AddLast(rmsdd); // 11 |
569a17d8 | 528 | |
af8e1c2d | 529 | histos.AddLast(zsdd); // 12 |
569a17d8 | 530 | |
af8e1c2d | 531 | histos.AddLast(zhsdd); // 13 |
569a17d8 | 532 | |
af8e1c2d | 533 | histos.AddLast(zmsdd); // 14 |
569a17d8 | 534 | |
af8e1c2d | 535 | histos.AddLast(rrsdd); // 15 |
569a17d8 | 536 | |
af8e1c2d | 537 | histos.AddLast(zrsdd); // 16 |
569a17d8 | 538 | |
af8e1c2d | 539 | histos.AddLast(enesdd); // 17 |
569a17d8 | 540 | |
af8e1c2d | 541 | // Book histogram SSD |
569a17d8 | 542 | |
af8e1c2d | 543 | TH2F *rssd = new TH2F("rssd","Radii of digits - SSD",50,-50.,50.,50,-50.,50.); |
569a17d8 | 544 | |
af8e1c2d | 545 | TH2F *rhssd = new TH2F("rhssd","Radii of hits - SSD",50,-50.,50.,50,-50.,50.); |
569a17d8 | 546 | |
af8e1c2d | 547 | TH2F *rmssd = new TH2F("rmssd","Radii of SSD modules",50,-50.,50.,50,-50.,50.); |
569a17d8 | 548 | |
af8e1c2d | 549 | TH1F *zssd = new TH1F("zssd","Z of digits - SSD",100,-70.,70.); |
569a17d8 | 550 | |
af8e1c2d | 551 | TH1F *zhssd = new TH1F("zhssd","Z of hits - SSD",100,-70.,70.); |
569a17d8 | 552 | |
af8e1c2d | 553 | TH1F *zmssd = new TH1F("zmssd","Z of SSD modules",100,-70,70.); |
569a17d8 | 554 | |
a6c9fb45 | 555 | Char_t title5[50]; |
569a17d8 | 556 | |
a6c9fb45 | 557 | Char_t title6[50]; |
569a17d8 | 558 | |
a6c9fb45 | 559 | if(userec){ |
569a17d8 | 560 | |
a6c9fb45 | 561 | sprintf(title5,"Radii of recpoints - %s","SSD"); |
569a17d8 | 562 | |
a6c9fb45 | 563 | sprintf(title6,"Z of recpoints - %s","SSD"); |
569a17d8 | 564 | |
a6c9fb45 | 565 | } |
569a17d8 | 566 | |
a6c9fb45 | 567 | if(useclustersv2){ |
569a17d8 | 568 | |
a6c9fb45 | 569 | sprintf(title5,"Radii of clustersV2 - %s","SSD"); |
569a17d8 | 570 | |
a6c9fb45 | 571 | sprintf(title6,"Z of clustersV2 - %s","SSD"); |
569a17d8 | 572 | |
a6c9fb45 | 573 | } |
574 | ||
569a17d8 | 575 | |
576 | ||
a6c9fb45 | 577 | TH2F *rrssd = new TH2F("rrssd",title5,50,-50.,50.,50,-50.,50.); |
569a17d8 | 578 | |
a6c9fb45 | 579 | TH1F *zrssd = new TH1F("zrssd",title6,100,-70.,70.); |
569a17d8 | 580 | |
af8e1c2d | 581 | TH1F *enessd = new TH1F("enessd","Energy deposition SSD (KeV)",100,0.,1000.); |
569a17d8 | 582 | |
af8e1c2d | 583 | histos.AddLast(rssd); // 18 |
569a17d8 | 584 | |
af8e1c2d | 585 | histos.AddLast(rhssd); // 19 |
569a17d8 | 586 | |
af8e1c2d | 587 | histos.AddLast(rmssd); // 20 |
569a17d8 | 588 | |
af8e1c2d | 589 | histos.AddLast(zssd); // 21 |
569a17d8 | 590 | |
af8e1c2d | 591 | histos.AddLast(zhssd); // 22 |
569a17d8 | 592 | |
af8e1c2d | 593 | histos.AddLast(zmssd); // 23 |
569a17d8 | 594 | |
af8e1c2d | 595 | histos.AddLast(rrssd); // 24 |
569a17d8 | 596 | |
af8e1c2d | 597 | histos.AddLast(zrssd); // 25 |
569a17d8 | 598 | |
af8e1c2d | 599 | histos.AddLast(enessd); // 26 |
569a17d8 | 600 | |
af8e1c2d | 601 | // |
569a17d8 | 602 | |
af8e1c2d | 603 | // Loop on subdetectors |
569a17d8 | 604 | |
af8e1c2d | 605 | // |
569a17d8 | 606 | |
af8e1c2d | 607 | AliITSgeom *geom = ITS->GetITSgeom(); |
569a17d8 | 608 | |
af8e1c2d | 609 | TString detna; // subdetector name |
569a17d8 | 610 | |
af8e1c2d | 611 | for(Int_t subd=0;subd<3;subd++){ |
569a17d8 | 612 | |
af8e1c2d | 613 | if(All || (choice.Contains("SPD") && subd==0) || (choice.Contains("SDD") && subd==1) || (choice.Contains("SSD") && subd==2)){ |
569a17d8 | 614 | |
af8e1c2d | 615 | // Prepare array for the digits |
569a17d8 | 616 | |
af8e1c2d | 617 | TClonesArray *ITSdigits = ITS->DigitsAddress(subd); |
569a17d8 | 618 | |
af8e1c2d | 619 | Bool_t usedigits = kTRUE; |
569a17d8 | 620 | |
af8e1c2d | 621 | if(!ITSdigits){ |
569a17d8 | 622 | |
af8e1c2d | 623 | usedigits = kFALSE; |
569a17d8 | 624 | |
813e97e8 | 625 | cout<<"\n ======================================================= \n"; |
569a17d8 | 626 | |
813e97e8 | 627 | cout<<"WARNING: there are no DIGITS on this file ! \n"; |
569a17d8 | 628 | |
813e97e8 | 629 | cout<<"======================================================= \n \n"; |
569a17d8 | 630 | |
af8e1c2d | 631 | } |
569a17d8 | 632 | |
af8e1c2d | 633 | // Get segmentation model |
569a17d8 | 634 | |
af8e1c2d | 635 | if(subd==0)detna="SPD"; |
569a17d8 | 636 | |
af8e1c2d | 637 | if(subd==1)detna="SDD"; |
569a17d8 | 638 | |
af8e1c2d | 639 | if(subd==2)detna="SSD"; |
569a17d8 | 640 | |
7d62fb64 | 641 | AliITSsegmentation *seg=(AliITSsegmentation*)detTypeRec->GetSegmentationModel(subd); |
569a17d8 | 642 | |
af8e1c2d | 643 | // Loop on modules |
569a17d8 | 644 | |
af8e1c2d | 645 | first = geom->GetStartDet(subd); |
569a17d8 | 646 | |
af8e1c2d | 647 | last = geom->GetLastDet(subd); |
569a17d8 | 648 | |
af8e1c2d | 649 | if(verbose){ |
569a17d8 | 650 | |
af8e1c2d | 651 | cout<<" "<<endl<<"-------------------------------------"<<endl; |
569a17d8 | 652 | |
af8e1c2d | 653 | cout<<"Start processing subdetector "<<detna<<endl; |
569a17d8 | 654 | |
af8e1c2d | 655 | cout<<detna<<" first module "<<first<<endl; |
569a17d8 | 656 | |
af8e1c2d | 657 | cout<<detna<<" last module "<<last<<endl; |
569a17d8 | 658 | |
af8e1c2d | 659 | cout<<" "<<endl<<" "<<endl; |
569a17d8 | 660 | |
af8e1c2d | 661 | } |
569a17d8 | 662 | |
af8e1c2d | 663 | for (mod=first; mod<=last; mod++){ |
569a17d8 | 664 | |
af8e1c2d | 665 | geom->GetTrans(mod,pos); // position of the module in the MRS |
569a17d8 | 666 | |
af8e1c2d | 667 | ragdet=sqrt(pos[0]*pos[0]+pos[1]*pos[1]); |
569a17d8 | 668 | |
af8e1c2d | 669 | // The following 2 histos are a check of the geometry |
569a17d8 | 670 | |
af8e1c2d | 671 | TH2F *bidi = (TH2F*)histos.At(2+subd*9); |
569a17d8 | 672 | |
af8e1c2d | 673 | TH1F *uni = (TH1F*)histos.At(5+subd*9); |
569a17d8 | 674 | |
af8e1c2d | 675 | bidi->Fill(pos[0],pos[1]); |
569a17d8 | 676 | |
af8e1c2d | 677 | uni->Fill(pos[2]); |
569a17d8 | 678 | |
af8e1c2d | 679 | if(verbose){ |
569a17d8 | 680 | |
813e97e8 | 681 | cout<<"=========================================================\n"; |
569a17d8 | 682 | |
af8e1c2d | 683 | cout<<detna<<" module="<<mod<<endl; |
569a17d8 | 684 | |
813e97e8 | 685 | cout<<"Mod. coordinates: "<<pos[0]<<", "<<pos[1]<<", "; |
569a17d8 | 686 | |
813e97e8 | 687 | cout<<pos[2]<<" Radius "<<ragdet<<endl; |
569a17d8 | 688 | |
af8e1c2d | 689 | } |
690 | ||
569a17d8 | 691 | |
692 | ||
af8e1c2d | 693 | // Hits |
569a17d8 | 694 | |
af8e1c2d | 695 | GetHitsCoor(ITS,mod,histos,subd,verbose); |
696 | ||
569a17d8 | 697 | |
698 | ||
af8e1c2d | 699 | //RecPoints |
569a17d8 | 700 | |
af8e1c2d | 701 | if(userec){ |
569a17d8 | 702 | |
7d62fb64 | 703 | detTypeRec->ResetRecPoints(); |
569a17d8 | 704 | |
813e97e8 | 705 | branch->GetEvent(mod); |
569a17d8 | 706 | |
af8e1c2d | 707 | TH2F *bidi=(TH2F*)histos.At(6+subd*9); |
569a17d8 | 708 | |
af8e1c2d | 709 | TH1F *uni=(TH1F*)histos.At(7+subd*9); |
569a17d8 | 710 | |
af8e1c2d | 711 | nrecp=GetRecCoor(geom,ITSrec,mod,bidi,uni,verbose); |
569a17d8 | 712 | |
af8e1c2d | 713 | } |
569a17d8 | 714 | |
a6c9fb45 | 715 | if(useclustersv2){ |
569a17d8 | 716 | |
00a7cc50 | 717 | detTypeRec->ResetRecPoints(); |
569a17d8 | 718 | |
a6c9fb45 | 719 | branch->GetEvent(mod); |
569a17d8 | 720 | |
a6c9fb45 | 721 | TH2F *bidi=(TH2F*)histos.At(6+subd*9); |
569a17d8 | 722 | |
a6c9fb45 | 723 | TH1F *uni=(TH1F*)histos.At(7+subd*9); |
569a17d8 | 724 | |
00a7cc50 | 725 | nrecp=GetClusCoor(geom,ITSrec,mod,bidi,uni,verbose); |
569a17d8 | 726 | |
7d62fb64 | 727 | |
569a17d8 | 728 | |
a6c9fb45 | 729 | } |
569a17d8 | 730 | |
af8e1c2d | 731 | |
569a17d8 | 732 | |
af8e1c2d | 733 | // Digits |
569a17d8 | 734 | |
af8e1c2d | 735 | if(usedigits){ |
569a17d8 | 736 | |
7d62fb64 | 737 | detTypeRec->ResetDigits(); |
569a17d8 | 738 | |
af8e1c2d | 739 | nbytes += TD->GetEvent(mod); |
569a17d8 | 740 | |
af8e1c2d | 741 | GetDigits(seg,geom,ITSdigits,subd,mod,verbose,histos); |
569a17d8 | 742 | |
af8e1c2d | 743 | } |
744 | ||
569a17d8 | 745 | |
746 | ||
af8e1c2d | 747 | } // End of loop on the modules |
569a17d8 | 748 | |
af8e1c2d | 749 | TH1F *h1tmp; |
569a17d8 | 750 | |
af8e1c2d | 751 | TH2F *h2tmp; |
569a17d8 | 752 | |
af8e1c2d | 753 | // Plot the histograms |
569a17d8 | 754 | |
af8e1c2d | 755 | TCanvas *current=0; // current Canvas (1--> SPD, 2---> SDD, 3---> SSD) |
569a17d8 | 756 | |
af8e1c2d | 757 | if(subd==0){ |
569a17d8 | 758 | |
af8e1c2d | 759 | // Prepare canvas 1 |
569a17d8 | 760 | |
af8e1c2d | 761 | TCanvas *c1 = new TCanvas("c1","SPD",10,10,600,900); |
569a17d8 | 762 | |
af8e1c2d | 763 | c1->Divide(2,3); |
569a17d8 | 764 | |
af8e1c2d | 765 | current=c1; |
569a17d8 | 766 | |
af8e1c2d | 767 | } |
569a17d8 | 768 | |
af8e1c2d | 769 | if(subd==1){ |
569a17d8 | 770 | |
af8e1c2d | 771 | // Prepare canvas 2 |
569a17d8 | 772 | |
af8e1c2d | 773 | TCanvas *c2 = new TCanvas("c2","SDD",40,40,600,900); |
569a17d8 | 774 | |
af8e1c2d | 775 | c2->Divide(2,3); |
569a17d8 | 776 | |
af8e1c2d | 777 | current=c2; |
569a17d8 | 778 | |
af8e1c2d | 779 | } |
569a17d8 | 780 | |
af8e1c2d | 781 | if(subd==2){ |
569a17d8 | 782 | |
af8e1c2d | 783 | // Prepare canvas 3 |
569a17d8 | 784 | |
af8e1c2d | 785 | TCanvas *c3 = new TCanvas("c3","SSD",70,70,600,900); |
569a17d8 | 786 | |
af8e1c2d | 787 | c3->Divide(2,3); |
569a17d8 | 788 | |
af8e1c2d | 789 | current=c3; |
569a17d8 | 790 | |
af8e1c2d | 791 | } |
569a17d8 | 792 | |
af8e1c2d | 793 | current->cd(1); |
569a17d8 | 794 | |
af8e1c2d | 795 | h2tmp = (TH2F*)histos.At(9*subd); |
569a17d8 | 796 | |
af8e1c2d | 797 | h2tmp->Draw(); |
569a17d8 | 798 | |
af8e1c2d | 799 | current->cd(2); |
569a17d8 | 800 | |
af8e1c2d | 801 | h1tmp=(TH1F*)histos.At(3+subd*9); |
569a17d8 | 802 | |
af8e1c2d | 803 | h1tmp->Draw(); |
569a17d8 | 804 | |
af8e1c2d | 805 | current->cd(3); |
569a17d8 | 806 | |
af8e1c2d | 807 | h2tmp=(TH2F*)histos.At(1+9*subd); |
569a17d8 | 808 | |
af8e1c2d | 809 | h2tmp->Draw(); |
569a17d8 | 810 | |
af8e1c2d | 811 | current->cd(4); |
569a17d8 | 812 | |
af8e1c2d | 813 | h1tmp=(TH1F*)histos.At(4+subd*9); |
569a17d8 | 814 | |
af8e1c2d | 815 | h1tmp->Draw(); |
569a17d8 | 816 | |
af8e1c2d | 817 | |
569a17d8 | 818 | |
a6c9fb45 | 819 | if(userec || useclustersv2){ |
569a17d8 | 820 | |
af8e1c2d | 821 | current->cd(5); |
569a17d8 | 822 | |
af8e1c2d | 823 | h2tmp=(TH2F*)histos.At(6+9*subd); |
569a17d8 | 824 | |
af8e1c2d | 825 | h2tmp->Draw(); |
569a17d8 | 826 | |
af8e1c2d | 827 | current->cd(6); |
569a17d8 | 828 | |
af8e1c2d | 829 | h1tmp=(TH1F*)histos.At(7+subd*9); |
569a17d8 | 830 | |
af8e1c2d | 831 | h1tmp->Draw(); |
569a17d8 | 832 | |
af8e1c2d | 833 | } |
569a17d8 | 834 | |
af8e1c2d | 835 | |
569a17d8 | 836 | |
af8e1c2d | 837 | else { |
569a17d8 | 838 | |
af8e1c2d | 839 | current->cd(5); |
569a17d8 | 840 | |
af8e1c2d | 841 | h2tmp=(TH2F*)histos.At(2+9*subd); |
569a17d8 | 842 | |
af8e1c2d | 843 | h2tmp->Draw(); |
569a17d8 | 844 | |
af8e1c2d | 845 | current->cd(6); |
569a17d8 | 846 | |
af8e1c2d | 847 | h2tmp=(TH2F*)histos.At(5+9*subd); |
569a17d8 | 848 | |
af8e1c2d | 849 | h2tmp->Draw(); |
569a17d8 | 850 | |
af8e1c2d | 851 | } |
569a17d8 | 852 | |
af8e1c2d | 853 | } // if(All..... |
569a17d8 | 854 | |
af8e1c2d | 855 | } // end of loop on subdetectors |
569a17d8 | 856 | |
af8e1c2d | 857 | // Save the histograms |
569a17d8 | 858 | |
813e97e8 | 859 | TFile *fh = new TFile("AliITSGeoPlot.root","recreate"); |
569a17d8 | 860 | |
af8e1c2d | 861 | // The list is written to file as a single entry |
569a17d8 | 862 | |
af8e1c2d | 863 | TList *lihi = new TList(); |
569a17d8 | 864 | |
af8e1c2d | 865 | // copy the pointers to the histograms to a TList object. |
569a17d8 | 866 | |
af8e1c2d | 867 | // The histograms concerning recpoints are not copied if |
569a17d8 | 868 | |
af8e1c2d | 869 | // 'userec' is false. |
569a17d8 | 870 | |
af8e1c2d | 871 | for(Int_t i=0;i<histos.GetEntriesFast();i++){ |
569a17d8 | 872 | |
af8e1c2d | 873 | if(choice.Contains("All") || (choice.Contains("SPD") && i<8) || (choice.Contains("SDD") && i>7 && i<16) || (choice.Contains("SSD") && i>15)){ |
569a17d8 | 874 | |
af8e1c2d | 875 | if(!(!userec && ((i+2)%9==0 || (i+1)%9==0)))lihi->Add(histos.At(i)); |
569a17d8 | 876 | |
af8e1c2d | 877 | } |
569a17d8 | 878 | |
af8e1c2d | 879 | } |
569a17d8 | 880 | |
af8e1c2d | 881 | lihi->Write("Histograms ITS hits+digits+recpoints",TObject::kSingleKey); |
569a17d8 | 882 | |
af8e1c2d | 883 | fh->Close(); |
884 | ||
569a17d8 | 885 | |
886 | ||
af8e1c2d | 887 | return retcode; |
569a17d8 | 888 | |
af8e1c2d | 889 | } |
890 | ||
891 | ||
569a17d8 | 892 | |
893 | ||
894 | ||
af8e1c2d | 895 | void GetHitsCoor(TObject *its, Int_t mod, TObjArray & histos, Int_t subd,Bool_t verb){ |
569a17d8 | 896 | |
af8e1c2d | 897 | TH2F *h2=(TH2F*)histos.At(1+subd*9); |
569a17d8 | 898 | |
af8e1c2d | 899 | TH1F *h1=(TH1F*)histos.At(4+subd*9); |
569a17d8 | 900 | |
af8e1c2d | 901 | TH1F *ener=(TH1F*)histos.At(8+subd*9); |
569a17d8 | 902 | |
af8e1c2d | 903 | AliITS *ITS= (AliITS*)its; |
569a17d8 | 904 | |
af8e1c2d | 905 | AliITSmodule *modu = ITS->GetModule(mod); |
569a17d8 | 906 | |
af8e1c2d | 907 | TObjArray *fHits = modu->GetHits(); |
569a17d8 | 908 | |
af8e1c2d | 909 | Int_t nhits = fHits->GetEntriesFast(); |
569a17d8 | 910 | |
af8e1c2d | 911 | if(nhits>0){ |
569a17d8 | 912 | |
af8e1c2d | 913 | if(verb){ |
569a17d8 | 914 | |
af8e1c2d | 915 | cout<<"-------------------------------------------------------"<<endl; |
569a17d8 | 916 | |
af8e1c2d | 917 | cout<<"Number of HITS for module "<<mod<<": "<<nhits<<endl; |
569a17d8 | 918 | |
af8e1c2d | 919 | } |
569a17d8 | 920 | |
af8e1c2d | 921 | for (Int_t hit=0;hit<nhits;hit++) { |
569a17d8 | 922 | |
af8e1c2d | 923 | AliITShit *iHit = (AliITShit*) fHits->At(hit); |
569a17d8 | 924 | |
af8e1c2d | 925 | if(!iHit->StatusEntering()){ |
569a17d8 | 926 | |
af8e1c2d | 927 | Float_t x=iHit->GetXG(); |
569a17d8 | 928 | |
af8e1c2d | 929 | Float_t y=iHit->GetYG(); |
569a17d8 | 930 | |
af8e1c2d | 931 | Float_t z=iHit->GetZG(); |
569a17d8 | 932 | |
af8e1c2d | 933 | Float_t edep=iHit->GetIonization()*1000000; |
569a17d8 | 934 | |
af8e1c2d | 935 | h2->Fill(x,y); |
569a17d8 | 936 | |
af8e1c2d | 937 | h1->Fill(z); |
569a17d8 | 938 | |
af8e1c2d | 939 | ener->Fill(edep); |
569a17d8 | 940 | |
af8e1c2d | 941 | if(verb){ |
569a17d8 | 942 | |
af8e1c2d | 943 | cout<<"hit # "<<hit<<" Global coordinates "<<x<<" "<<y<<" "<<z<<endl; |
569a17d8 | 944 | |
813e97e8 | 945 | cout<<"track # "<<iHit->GetTrack()<<" energy deposition (KeV)= "; |
569a17d8 | 946 | |
813e97e8 | 947 | cout<<edep<<endl; |
569a17d8 | 948 | |
af8e1c2d | 949 | } |
569a17d8 | 950 | |
af8e1c2d | 951 | } |
569a17d8 | 952 | |
af8e1c2d | 953 | } |
569a17d8 | 954 | |
af8e1c2d | 955 | } |
569a17d8 | 956 | |
af8e1c2d | 957 | } |
958 | ||
959 | ||
569a17d8 | 960 | |
961 | ||
962 | ||
a6c9fb45 | 963 | Int_t GetClusCoor(TObject *ge, TClonesArray *ITSrec, Int_t mod, TH2F *h2, TH1F *h1, Bool_t verb){ |
7d62fb64 | 964 | |
569a17d8 | 965 | |
966 | ||
a6c9fb45 | 967 | AliITSgeom *geom = (AliITSgeom*)ge; |
569a17d8 | 968 | |
a6c9fb45 | 969 | Int_t nrecp = ITSrec->GetEntries(); |
569a17d8 | 970 | |
a6c9fb45 | 971 | if(nrecp>0){ |
569a17d8 | 972 | |
a6c9fb45 | 973 | Float_t lc[3]; for(Int_t i=0; i<3; i++) lc[i]=0.; |
569a17d8 | 974 | |
a6c9fb45 | 975 | Float_t gc[3]; for(Int_t i=0; i<3; i++) gc[i]=0.; |
569a17d8 | 976 | |
a6c9fb45 | 977 | if(verb){ |
569a17d8 | 978 | |
a6c9fb45 | 979 | cout<<"-------------------------------------------------------"<<endl; |
569a17d8 | 980 | |
a6c9fb45 | 981 | cout<<"Number of CLUSTERS for module "<<mod<<": "<<nrecp<<endl; |
569a17d8 | 982 | |
a6c9fb45 | 983 | } |
569a17d8 | 984 | |
a6c9fb45 | 985 | for(Int_t irec=0;irec<nrecp;irec++) { |
569a17d8 | 986 | |
00a7cc50 | 987 | AliITSRecPoint *recp = (AliITSRecPoint*)ITSrec->At(irec); |
569a17d8 | 988 | |
a6c9fb45 | 989 | Double_t rot[9]; |
569a17d8 | 990 | |
a6c9fb45 | 991 | geom->GetRotMatrix(mod,rot); |
569a17d8 | 992 | |
a6c9fb45 | 993 | Int_t lay,lad,det; |
569a17d8 | 994 | |
a6c9fb45 | 995 | geom->GetModuleId(mod,lay,lad,det); |
569a17d8 | 996 | |
a6c9fb45 | 997 | Float_t tx,ty,tz; |
569a17d8 | 998 | |
a6c9fb45 | 999 | geom->GetTrans(lay,lad,det,tx,ty,tz); |
1000 | ||
569a17d8 | 1001 | |
1002 | ||
a6c9fb45 | 1003 | Double_t alpha=TMath::ATan2(rot[1],rot[0])+TMath::Pi(); |
569a17d8 | 1004 | |
a6c9fb45 | 1005 | Double_t phi1=TMath::Pi()/2+alpha; |
569a17d8 | 1006 | |
a6c9fb45 | 1007 | if(lay==1) phi1+=TMath::Pi(); |
1008 | ||
569a17d8 | 1009 | |
1010 | ||
a6c9fb45 | 1011 | Float_t cp=TMath::Cos(phi1), sp=TMath::Sin(phi1); |
569a17d8 | 1012 | |
a6c9fb45 | 1013 | Float_t r=tx*cp+ty*sp; |
569a17d8 | 1014 | |
a6c9fb45 | 1015 | gc[0]= r*cp - recp->GetY()*sp; |
569a17d8 | 1016 | |
a6c9fb45 | 1017 | gc[1]= r*sp + recp->GetY()*cp; |
569a17d8 | 1018 | |
a6c9fb45 | 1019 | gc[2]=recp->GetZ(); |
569a17d8 | 1020 | |
a6c9fb45 | 1021 | |
569a17d8 | 1022 | |
a6c9fb45 | 1023 | if(verb){ |
569a17d8 | 1024 | |
a6c9fb45 | 1025 | Float_t r=sqrt(gc[0]*gc[0]+gc[1]*gc[1]); |
569a17d8 | 1026 | |
a6c9fb45 | 1027 | cout<<"Global coor. + radius "<<gc[0]<<" "<<gc[1]<<" "<<gc[2]<<" "; |
569a17d8 | 1028 | |
a6c9fb45 | 1029 | cout<<r<<endl; |
569a17d8 | 1030 | |
a6c9fb45 | 1031 | cout<<"Associated track "<<recp->GetLabel(0)<<endl; |
569a17d8 | 1032 | |
a6c9fb45 | 1033 | } |
569a17d8 | 1034 | |
a6c9fb45 | 1035 | h2->Fill(gc[0],gc[1]); |
569a17d8 | 1036 | |
a6c9fb45 | 1037 | h1->Fill(gc[2]); |
7d62fb64 | 1038 | |
569a17d8 | 1039 | |
1040 | ||
a6c9fb45 | 1041 | } |
569a17d8 | 1042 | |
a6c9fb45 | 1043 | } |
569a17d8 | 1044 | |
a6c9fb45 | 1045 | return nrecp; |
569a17d8 | 1046 | |
a6c9fb45 | 1047 | } |
569a17d8 | 1048 | |
af8e1c2d | 1049 | Int_t GetRecCoor(TObject *ge, TClonesArray *ITSrec, Int_t mod, TH2F *h2, TH1F *h1, Bool_t verb){ |
569a17d8 | 1050 | |
af8e1c2d | 1051 | AliITSgeom *geom = (AliITSgeom*)ge; |
569a17d8 | 1052 | |
af8e1c2d | 1053 | Int_t nrecp = ITSrec->GetEntries(); |
569a17d8 | 1054 | |
af8e1c2d | 1055 | if(nrecp>0){ |
569a17d8 | 1056 | |
af8e1c2d | 1057 | Float_t lc[3]; for(Int_t i=0; i<3; i++) lc[i]=0.; |
569a17d8 | 1058 | |
af8e1c2d | 1059 | Float_t gc[3]; for(Int_t i=0; i<3; i++) gc[i]=0.; |
569a17d8 | 1060 | |
af8e1c2d | 1061 | if(verb){ |
569a17d8 | 1062 | |
af8e1c2d | 1063 | cout<<"-------------------------------------------------------"<<endl; |
569a17d8 | 1064 | |
af8e1c2d | 1065 | cout<<"Number of REC POINTS for module "<<mod<<": "<<nrecp<<endl; |
569a17d8 | 1066 | |
af8e1c2d | 1067 | } |
569a17d8 | 1068 | |
af8e1c2d | 1069 | for(Int_t irec=0;irec<nrecp;irec++) { |
569a17d8 | 1070 | |
af8e1c2d | 1071 | AliITSRecPoint *recp = (AliITSRecPoint*)ITSrec->At(irec); |
569a17d8 | 1072 | |
00a7cc50 | 1073 | lc[0]=recp->GetDetLocalX(); |
569a17d8 | 1074 | |
00a7cc50 | 1075 | lc[2]=recp->GetDetLocalZ(); |
569a17d8 | 1076 | |
af8e1c2d | 1077 | geom->LtoG(mod,lc,gc); |
569a17d8 | 1078 | |
af8e1c2d | 1079 | if(verb){ |
569a17d8 | 1080 | |
813e97e8 | 1081 | cout<<"recp # "<<irec<<" local coordinates. lx= "<<lc[0]<<" lz= "; |
569a17d8 | 1082 | |
813e97e8 | 1083 | cout<<lc[2]<<endl; |
569a17d8 | 1084 | |
af8e1c2d | 1085 | Float_t r=sqrt(gc[0]*gc[0]+gc[1]*gc[1]); |
569a17d8 | 1086 | |
813e97e8 | 1087 | cout<<"Global coor. + radius "<<gc[0]<<" "<<gc[1]<<" "<<gc[2]<<" "; |
569a17d8 | 1088 | |
813e97e8 | 1089 | cout<<r<<endl; |
569a17d8 | 1090 | |
813e97e8 | 1091 | cout<<"Associated track "<<recp->GetLabel(0)<<endl; |
569a17d8 | 1092 | |
af8e1c2d | 1093 | } |
569a17d8 | 1094 | |
af8e1c2d | 1095 | h2->Fill(gc[0],gc[1]); |
569a17d8 | 1096 | |
af8e1c2d | 1097 | h1->Fill(gc[2]); |
569a17d8 | 1098 | |
af8e1c2d | 1099 | } |
569a17d8 | 1100 | |
af8e1c2d | 1101 | } |
569a17d8 | 1102 | |
af8e1c2d | 1103 | return nrecp; |
569a17d8 | 1104 | |
af8e1c2d | 1105 | } |
1106 | ||
569a17d8 | 1107 | |
1108 | ||
af8e1c2d | 1109 | void GetDigits(TObject *tmps,TObject *ge,TClonesArray *ITSdigits, Int_t subd, Int_t mod, Bool_t verbose, TObjArray & histos){ |
569a17d8 | 1110 | |
af8e1c2d | 1111 | AliITSsegmentation *seg = (AliITSsegmentation*)tmps; |
569a17d8 | 1112 | |
af8e1c2d | 1113 | AliITSgeom *geom = (AliITSgeom*)ge; |
569a17d8 | 1114 | |
af8e1c2d | 1115 | Int_t layer; |
569a17d8 | 1116 | |
af8e1c2d | 1117 | Int_t ladder; |
569a17d8 | 1118 | |
af8e1c2d | 1119 | Int_t detec; |
569a17d8 | 1120 | |
af8e1c2d | 1121 | if(subd==2){ |
569a17d8 | 1122 | |
af8e1c2d | 1123 | geom->GetModuleId(mod,layer,ladder,detec); |
569a17d8 | 1124 | |
af8e1c2d | 1125 | seg->SetLayer(layer); |
569a17d8 | 1126 | |
af8e1c2d | 1127 | } |
569a17d8 | 1128 | |
af8e1c2d | 1129 | Float_t lcoor[3]; for(Int_t j=0; j<3; j++) lcoor[j]=0.; //local coord dig. |
569a17d8 | 1130 | |
af8e1c2d | 1131 | Float_t gcoor[3]; for(Int_t j=0; j<3; j++) gcoor[j]=0.; // global coo. dig. |
569a17d8 | 1132 | |
af8e1c2d | 1133 | Float_t ragdig; // Radius digit |
569a17d8 | 1134 | |
af8e1c2d | 1135 | TArrayI ssdone(5000); // used to match p and n side digits of strips |
569a17d8 | 1136 | |
af8e1c2d | 1137 | TArrayI pair(5000); // as above |
569a17d8 | 1138 | |
af8e1c2d | 1139 | Int_t ndigits = ITSdigits->GetEntries(); |
569a17d8 | 1140 | |
af8e1c2d | 1141 | AliITSdigit *digs; |
569a17d8 | 1142 | |
af8e1c2d | 1143 | if(ndigits){ |
569a17d8 | 1144 | |
af8e1c2d | 1145 | if(verbose){ |
569a17d8 | 1146 | |
af8e1c2d | 1147 | cout<<"-------------------------------------------------------"<<endl; |
569a17d8 | 1148 | |
af8e1c2d | 1149 | cout<<"Number of DIGITS for module "<<mod<<": "<<ndigits<<endl; |
569a17d8 | 1150 | |
af8e1c2d | 1151 | } |
569a17d8 | 1152 | |
af8e1c2d | 1153 | // Get the coordinates of the module |
569a17d8 | 1154 | |
af8e1c2d | 1155 | if(subd==2){ |
569a17d8 | 1156 | |
af8e1c2d | 1157 | for (Int_t digit=0;digit<ndigits;digit++){ |
569a17d8 | 1158 | |
af8e1c2d | 1159 | ssdone[digit]=0; |
569a17d8 | 1160 | |
af8e1c2d | 1161 | pair[digit]=0; |
569a17d8 | 1162 | |
af8e1c2d | 1163 | } |
569a17d8 | 1164 | |
af8e1c2d | 1165 | } |
569a17d8 | 1166 | |
af8e1c2d | 1167 | for (Int_t digit=0;digit<ndigits;digit++) { |
569a17d8 | 1168 | |
af8e1c2d | 1169 | digs = (AliITSdigit*)ITSdigits->UncheckedAt(digit); |
569a17d8 | 1170 | |
0be9848a | 1171 | Int_t iz=digs->GetCoord1(); // cell number z |
569a17d8 | 1172 | |
0be9848a | 1173 | Int_t ix=digs->GetCoord2(); // cell number x |
569a17d8 | 1174 | |
af8e1c2d | 1175 | // Get local coordinates of the element |
569a17d8 | 1176 | |
af8e1c2d | 1177 | if(subd<2){ |
569a17d8 | 1178 | |
af8e1c2d | 1179 | seg->DetToLocal(ix,iz,lcoor[0],lcoor[2]); |
569a17d8 | 1180 | |
af8e1c2d | 1181 | } |
569a17d8 | 1182 | |
af8e1c2d | 1183 | else{ |
569a17d8 | 1184 | |
af8e1c2d | 1185 | // SSD: if iz==0 ---> N side; if iz==1 P side |
569a17d8 | 1186 | |
af8e1c2d | 1187 | if(ssdone[digit]==0){ |
569a17d8 | 1188 | |
af8e1c2d | 1189 | ssdone[digit]=1; |
569a17d8 | 1190 | |
af8e1c2d | 1191 | pair[digit]=-1; |
569a17d8 | 1192 | |
af8e1c2d | 1193 | Bool_t pside=(iz==1); |
569a17d8 | 1194 | |
af8e1c2d | 1195 | Bool_t impaired=kTRUE; |
569a17d8 | 1196 | |
af8e1c2d | 1197 | Int_t pstrip=0; |
569a17d8 | 1198 | |
af8e1c2d | 1199 | Int_t nstrip=0; |
569a17d8 | 1200 | |
af8e1c2d | 1201 | if(pside)pstrip=ix; |
569a17d8 | 1202 | |
af8e1c2d | 1203 | if(!pside)nstrip=ix; |
569a17d8 | 1204 | |
af8e1c2d | 1205 | for(Int_t digi2=0;digi2<ndigits;digi2++){ |
569a17d8 | 1206 | |
af8e1c2d | 1207 | if(ssdone[digi2]==0 && impaired){ |
569a17d8 | 1208 | |
af8e1c2d | 1209 | AliITSdigitSSD *dig2=(AliITSdigitSSD*)ITSdigits->UncheckedAt(digi2); |
569a17d8 | 1210 | |
0be9848a | 1211 | if(dig2->GetCoord1() != iz && dig2->GetTrack(0)==digs->GetTrack(0) && dig2->GetTrack(0)>0){ |
569a17d8 | 1212 | |
af8e1c2d | 1213 | ssdone[digi2]=2; |
569a17d8 | 1214 | |
af8e1c2d | 1215 | pair[digit]=digi2; |
569a17d8 | 1216 | |
0be9848a | 1217 | if(pside)nstrip=dig2->GetCoord2(); |
569a17d8 | 1218 | |
0be9848a | 1219 | if(!pside)pstrip=dig2->GetCoord2(); |
569a17d8 | 1220 | |
af8e1c2d | 1221 | impaired=kFALSE; |
569a17d8 | 1222 | |
af8e1c2d | 1223 | } |
569a17d8 | 1224 | |
af8e1c2d | 1225 | } |
569a17d8 | 1226 | |
af8e1c2d | 1227 | } |
569a17d8 | 1228 | |
af8e1c2d | 1229 | if(!impaired)seg->GetPadCxz(pstrip,nstrip,lcoor[0],lcoor[2]); |
569a17d8 | 1230 | |
af8e1c2d | 1231 | } |
569a17d8 | 1232 | |
af8e1c2d | 1233 | } |
569a17d8 | 1234 | |
af8e1c2d | 1235 | if(subd<2 || (subd==2 && ssdone[digit]==1)){ |
569a17d8 | 1236 | |
0be9848a | 1237 | Int_t coor1=digs->GetCoord1(); |
569a17d8 | 1238 | |
0be9848a | 1239 | Int_t coor2=digs->GetCoord2(); |
569a17d8 | 1240 | |
af8e1c2d | 1241 | Int_t tra0=digs->GetTrack(0); |
569a17d8 | 1242 | |
af8e1c2d | 1243 | if(verbose){ |
569a17d8 | 1244 | |
813e97e8 | 1245 | cout<<"digit # "<<digit<<" fCoord1= "<<coor1<<" fCoord2= "; |
569a17d8 | 1246 | |
813e97e8 | 1247 | cout<<coor2<<" track "<<tra0<<" "<<endl; |
569a17d8 | 1248 | |
813e97e8 | 1249 | if(subd<2)cout<<"local coordinates -- x="<<lcoor[0]<<", z="; |
569a17d8 | 1250 | |
813e97e8 | 1251 | cout<<lcoor[2]<<endl; |
569a17d8 | 1252 | |
af8e1c2d | 1253 | if(subd==2){ |
569a17d8 | 1254 | |
af8e1c2d | 1255 | if(pair[digit]==-1){ |
569a17d8 | 1256 | |
af8e1c2d | 1257 | cout<<"(digit not paired)"<<endl; |
569a17d8 | 1258 | |
af8e1c2d | 1259 | } |
569a17d8 | 1260 | |
af8e1c2d | 1261 | else { |
569a17d8 | 1262 | |
813e97e8 | 1263 | cout<<"local coordinates -- x="<<lcoor[0]<<", z="<<lcoor[2]; |
569a17d8 | 1264 | |
813e97e8 | 1265 | cout<<endl; |
569a17d8 | 1266 | |
af8e1c2d | 1267 | Int_t dtmp=pair[digit]; |
569a17d8 | 1268 | |
af8e1c2d | 1269 | AliITSdigitSSD *dig2=(AliITSdigitSSD*)ITSdigits->UncheckedAt(dtmp); |
569a17d8 | 1270 | |
0be9848a | 1271 | Int_t coor1b=dig2->GetCoord1(); |
569a17d8 | 1272 | |
0be9848a | 1273 | Int_t coor2b=dig2->GetCoord2(); |
569a17d8 | 1274 | |
af8e1c2d | 1275 | Int_t tra0b=dig2->GetTrack(0); |
569a17d8 | 1276 | |
af8e1c2d | 1277 | cout<<"(digit paired with digit #"<<dtmp<<endl; |
569a17d8 | 1278 | |
813e97e8 | 1279 | cout<<"with fCoord1= "<<coor1b<<" fCoord2= "<<coor2b; |
569a17d8 | 1280 | |
813e97e8 | 1281 | cout<<" track "<<tra0b<<")"<<endl; |
569a17d8 | 1282 | |
af8e1c2d | 1283 | } |
569a17d8 | 1284 | |
af8e1c2d | 1285 | } |
569a17d8 | 1286 | |
af8e1c2d | 1287 | } |
569a17d8 | 1288 | |
af8e1c2d | 1289 | if(subd<2 || (subd==2 && pair[digit]!=-1)){ |
569a17d8 | 1290 | |
af8e1c2d | 1291 | // Global coordinates of the element |
569a17d8 | 1292 | |
af8e1c2d | 1293 | //SDD and SPD use cm, SSD microns (GetPadCxz) |
569a17d8 | 1294 | |
af8e1c2d | 1295 | if(subd==2)for(Int_t j=0;j<3;j++)lcoor[j]=lcoor[j]/10000.; |
569a17d8 | 1296 | |
af8e1c2d | 1297 | lcoor[1]=0.; |
569a17d8 | 1298 | |
af8e1c2d | 1299 | geom->LtoG(mod,lcoor,gcoor); // global coord. in cm |
569a17d8 | 1300 | |
af8e1c2d | 1301 | ragdig=sqrt(gcoor[0]*gcoor[0]+gcoor[1]*gcoor[1]); |
569a17d8 | 1302 | |
544f2385 | 1303 | if(verbose){ |
569a17d8 | 1304 | |
a6c9fb45 | 1305 | cout<<"global coordinates "<<gcoor[0]<<" "<<gcoor[1]; |
569a17d8 | 1306 | |
a6c9fb45 | 1307 | cout<<" "<<gcoor[2]<<" Radius "<<ragdig<<endl; |
569a17d8 | 1308 | |
544f2385 | 1309 | } |
569a17d8 | 1310 | |
af8e1c2d | 1311 | //Fill histograms |
569a17d8 | 1312 | |
af8e1c2d | 1313 | TH2F *bidi = (TH2F*)histos.At(subd*9); |
569a17d8 | 1314 | |
af8e1c2d | 1315 | TH1F *uni = (TH1F*)histos.At(3+subd*9); |
569a17d8 | 1316 | |
af8e1c2d | 1317 | bidi->Fill(gcoor[0],gcoor[1]); |
569a17d8 | 1318 | |
af8e1c2d | 1319 | uni->Fill(gcoor[2]); |
569a17d8 | 1320 | |
af8e1c2d | 1321 | } |
569a17d8 | 1322 | |
af8e1c2d | 1323 | } |
569a17d8 | 1324 | |
af8e1c2d | 1325 | } // loop on digits for this module |
569a17d8 | 1326 | |
af8e1c2d | 1327 | } // if(ndigits>0.... |
569a17d8 | 1328 | |
af8e1c2d | 1329 | } |
569a17d8 | 1330 |