1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 #include <Riostream.h>
20 #include <TDirectory.h>
22 #include "AliRunLoader.h"
24 #include "AliSTARTLoader.h"
25 #include "AliSTARTdigit.h"
26 #include "AliSTARTReconstructor.h"
28 #include <TClonesArray.h>
29 #include "AliSTARTRecPoint.h"
30 #include "AliRawReader.h"
31 #include "AliSTARTRawReader.h"
33 ClassImp(AliSTARTReconstructor)
35 void AliSTARTReconstructor::ConvertDigits(AliRawReader* rawReader, TTree* digitsTree) const
37 //START raw data-> digits conversion
38 // reconstruct time information from raw data
39 AliSTARTRawReader myrawreader(rawReader,digitsTree);
40 myrawreader.NextThing();
42 void AliSTARTReconstructor::Reconstruct(TTree*digitsTree, TTree*clustersTree) const
44 // START digits reconstruction
45 // STARTRecPoint writing
47 AliDebug(1,Form("Start DIGITS reconstruction "));
48 Int_t channelWigth=25; //ps
49 TArrayI* fSumMult = new TArrayI(6);
50 Float_t ph2mV = 150./500.;
51 Float_t mV2channel=200000/(25*25); //5V -> 200ns
53 TBranch *brDigits=digitsTree->GetBranch("START");
54 AliSTARTdigit *fDigits = new AliSTARTdigit();
56 brDigits->SetAddress(&fDigits);
58 cerr<<"EXEC Branch START digits not found"<<endl;
61 brDigits->GetEntry(0);
62 Int_t besttimeright=channelWigth * (fDigits->BestTimeRight());
63 Int_t besttimeleft=channelWigth * (fDigits->BestTimeLeft());
65 //folding with experimental time distribution
66 // Float_t c = 29.9792; // cm/ns
67 Float_t c = 0.0299792; // cm/ps
68 Float_t lenr=TMath::Sqrt(350*350 + 6.5*6.5);
69 Float_t lenl=TMath::Sqrt(69.7*69.7 + 6.5*6.5);
70 Float_t timeDiff=channelWigth * (fDigits->TimeDiff());
71 Int_t meanTime=channelWigth * (fDigits->MeanTime());
72 Float_t ds=(c*(timeDiff)-(lenr-lenl))/2;
73 AliDebug(2,Form(" timediff in ns %f real point%f",timeDiff,ds));
77 fDigits->GetSumMult(*fSumMult);
79 for (Int_t i=0; i<6; i++)
81 Float_t mult=Float_t (fSumMult->At(i));
82 Float_t realMultmV=TMath::Exp(mult/mV2channel);
83 multipl[i]=Int_t ((realMultmV/ph2mV)/500+0.5);
85 AliDebug(2,Form(" multiplicity Abs side %i multiplicity non-Abs side %i",multipl[1],multipl[2]));
87 AliSTARTRecPoint* frecpoints= new AliSTARTRecPoint ();
88 clustersTree->Branch( "START", "AliSTARTRecPoint" ,&frecpoints, 405,1);
89 frecpoints->SetTimeBestRight(besttimeright);
90 frecpoints->SetTimeBestLeft(besttimeleft);
91 frecpoints->SetVertex(ds);
92 frecpoints->SetMeanTime(meanTime);
93 frecpoints->SetMult(multipl[0]);
94 frecpoints->SetMultA(multipl[2]);
95 frecpoints->SetMultC(multipl[1]);
101 void AliSTARTReconstructor::FillESD(AliRunLoader* runLoader, AliESD *pESD) const
104 /***************************************************
105 Resonstruct digits to vertex position
106 ****************************************************/
108 // Float_t c = 0.3; //speed of light mm/ps
109 // Float_t Zposition=0;
112 AliError("Reconstruct >> No run loader");
116 AliDebug(1,Form("Start FillESD START"));
118 AliSTARTLoader* pStartLoader = (AliSTARTLoader*) runLoader->GetLoader("STARTLoader");
120 pStartLoader->LoadRecPoints("READ");
122 TTree *treeR = pStartLoader->TreeR();
124 AliSTARTRecPoint* frecpoints= new AliSTARTRecPoint ();
126 AliError("Reconstruct Fill ESD >> no recpoints found");
130 AliDebug(1,Form("Start FillESD START"));
131 TBranch *brRec = treeR->GetBranch("START");
133 brRec->SetAddress(&frecpoints);
135 cerr<<"EXEC Branch START rec not found"<<endl;
140 Float_t Zposition=frecpoints->GetVertex();
142 pESD->SetT0zVertex(Zposition);
143 pStartLoader->UnloadRecPoints();
145 } // vertex in 3 sigma