]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGPP/TRD/macros/EVE/PH.C
Moving PWG1 to PWGPP
[u/mrichter/AliRoot.git] / PWGPP / TRD / macros / EVE / PH.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <TRD/AliTRDgeometry.h>
3 #include <TRD/AliTRDcalibDB.h>
4 #include <TRD/AliTRDcluster.h>
5 #include <TRD/AliTRDseed.h>
6 #include <TRD/AliTRDseedV1.h>
7 #include <TRD/AliTRDtrackV1.h>
8 #include <TProfile.h>
9 #endif
10
11 TH1* PH(const TObject* object)
12 {
13   if (!object) return 0x0;
14   if (object->IsA() != AliTRDtrackV1::Class()) return 0x0;
15
16   const AliTRDtrackV1* track = dynamic_cast<const AliTRDtrackV1*>(object); 
17   if (!track)  return 0x0;
18   
19   AliTRDcluster* cls = 0;
20   AliTRDseedV1 *tracklet = 0x0;
21
22   Int_t ntb = AliTRDcalibDB::Instance()->GetNumberOfTimeBins();
23   TProfile* ph = new TProfile("", "Average PH", ntb, -.5, ntb-.5);
24   ph->GetXaxis()->SetTitle("drift time [1/100ns]");
25   ph->GetYaxis()->SetTitle("<PH> [a.u.]");
26
27   for (Int_t ily = 0; ily < AliTRDgeometry::kNlayer; ily++) {
28     if(!(tracklet = track->GetTracklet(ily))) continue;
29     if(!tracklet->IsOK()) continue;
30     
31     for (Int_t icl = 0; icl < AliTRDseed::knTimebins; icl++) {
32       if(!(cls = tracklet->GetClusters(icl))) continue;
33             
34             ph->Fill(cls->GetLocalTimeBin(), cls->GetQ());
35           }
36   }
37
38   return ph;
39 }
40