24 #if !defined(__CINT__) || defined(__MAKECINT__)
25 #include <TStopwatch.h>
27 #include <TObjArray.h>
30 #include <Riostream.h>
36 #include "AliESDEvent.h"
37 #include "AliRecoParam.h"
38 #include "AliCDBManager.h"
39 #include "AliRunLoader.h"
40 #include "AliLoader.h"
41 #include "AliHeader.h"
69 void MUONClusterInfo(Int_t nevents = -1,
const char* esdFileName =
"AliESDs.root",
const char* inFileName =
"galice.root",
70 const TString ocdbPath =
"local://$ALICE_ROOT/OCDB",
const char* outFileName =
"clusterInfo.root")
84 Bool_t useESD = (strcmp(esdFileName,
""));
85 Bool_t useRecPoints = (strcmp(inFileName,
""));
86 if (!useESD && !useRecPoints) {
87 Error(
"MUONClusterInfo",
"you must provide ESD and/or galice root file(s)");
100 TTree* esdTree = 0x0;
101 AliESDEvent* esd = 0x0;
106 esd =
new AliESDEvent();
107 esd->ReadFromTree(esdTree);
108 if (esdTree->GetEvent(0) <= 0) {
109 Error(
"MUONClusterInfo",
"no ESD object found for event 0");
112 runNumber = esd->GetRunNumber();
116 AliRunLoader * rl = 0x0;
117 AliLoader* MUONLoader = 0x0;
120 MUONLoader = rl->GetDetectorLoader(
"MUON");
121 MUONLoader->LoadRecPoints(
"READ");
122 MUONLoader->LoadDigits(
"READ");
124 if (runNumber < 0) runNumber = rl->GetHeader()->GetRun();
128 AliCDBManager::Instance()->SetDefaultStorage(ocdbPath);
129 AliCDBManager::Instance()->SetRun(runNumber);
133 if (!recoParam)
return;
143 TFile* clusterInfoFile =
TFile::Open(outFileName,
"RECREATE");
144 clusterInfoFile->SetCompressionLevel(1);
146 TTree* clusterInfoTree =
new TTree(
"clusterInfoTree",
"clusterInfoTree");
147 clusterInfoTree->Branch(
"clusterInfo", &clusterInfo, 32000, 99);
154 if (nevents > 0) nevents = TMath::Min(nevents,(Int_t)esdTree->GetEntries());
155 else nevents = (Int_t)esdTree->GetEntries();
157 if (nevents > 0) nevents = TMath::Min(nevents,(Int_t)rl->GetNumberOfEvents());
158 else nevents = (Int_t)rl->GetNumberOfEvents();
160 for (Int_t iEvent = 0; iEvent < nevents; iEvent++) {
167 esdTree->GetEvent(iEvent);
169 Error(
"MUONClusterInfo",
"no ESD object found for event %d", iEvent);
175 if (!useRecPoints) digitStore = esdInterface.
GetDigits();
179 if (!(rl->GetEvent(iEvent) == 0)) {
180 Error(
"MUONClusterInfo",
"unable to load event %d", iEvent);
184 TTree* treeR = MUONLoader->TreeR();
186 if ( clusterStore != 0x0 ) {
187 clusterStore->
Clear();
192 TTree* treeD = MUONLoader->TreeD();
195 if ( digitStore != 0x0 ) {
211 while ((track = static_cast<AliMUONTrack*>(nextTrack()))) {
218 clusterInfo->
Clear(
"C");
222 clusterInfo->
SetRunId(esd->GetRunNumber());
232 clusterInfo->
SetTrackId(track->GetUniqueID());
237 clusterInfo->
SetTrackXYErr(TMath::Sqrt(paramCov(0,0)), TMath::Sqrt(paramCov(2,2)));
244 if (digitStore)
for (Int_t i=0; i<cluster->
GetNDigits(); i++) {
246 if (!digit)
continue;
262 padInfo.
SetPadId(digit->GetUniqueID());
272 clusterInfo->
AddPad(padInfo);
278 if (cl) clusterStore->
Remove(*cl);
282 clusterInfoTree->Fill();
284 trackParam =
static_cast<AliMUONTrackParam*
>(track->GetTrackParamAtCluster()->After(trackParam));
296 while ( ( cluster = static_cast<AliMUONVCluster*>(nextCluster()) ) ) {
298 clusterInfo->
Clear(
"C");
301 clusterInfo->
SetRunId(rl->GetRunNumber());
303 clusterInfo->
SetZ(cluster->GetZ());
305 clusterInfo->
SetClusterXY(cluster->GetX(), cluster->GetY());
322 if (digitStore)
for (Int_t i=0; i<cluster->GetNDigits(); i++) {
324 if (!digit)
continue;
340 padInfo.
SetPadId(digit->GetUniqueID());
350 clusterInfo->
AddPad(padInfo);
354 clusterInfoTree->Fill();
369 clusterInfoFile->cd();
370 clusterInfoTree->Write();
371 printf(
"Deleting Tree\n");
372 delete clusterInfoTree;
374 clusterInfoFile->Close();
377 printf(
"Deleting calibData\n");
379 printf(
"Deleting clusterInfo\n");
382 MUONLoader->UnloadDigits();
383 MUONLoader->UnloadRecPoints();
391 cout<<endl<<
"time to fill cluster/track info: R:"<<timer.RealTime()<<
" C:"<<timer.CpuTime()<<endl<<endl;
400 if (!esdFile || !esdFile->IsOpen()) {
401 Error(
"GetESDTree",
"opening ESD file failed");
405 TTree*
tree = (TTree*) esdFile->Get(
"esdTree");
407 Error(
"GetESDTree",
"no ESD tree found");
421 UInt_t muonClusterMap = 0;
431 return muonClusterMap;
virtual Int_t ManuChannel() const =0
The channel within ManuId() this digit belongs to (manuChannel for tracker, localBoardChannel for tri...
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
void SetCalibrated(Bool_t calibrated=kTRUE)
Set the pad as being calibrated or not.
TFile * Open(const char *filename, Long64_t &nevents)
void SetTrackNHits(UInt_t NHits)
Set the total number of hits associated to the track leaving this cluster.
void SetPedestal(Float_t mean, Float_t sigma)
Set pedestal parameters.
virtual Int_t PadY() const =0
The y-index of this digit (>=0)
void SetClusterXY(Double_t x, Double_t y)
Set cluster coordinates (cm)
Interface for a digit container.
static AliMpSegmentation * Instance(Bool_t warn=true)
virtual Double_t GetZ() const =0
Return coordinate Z (cm)
void SetPadDimXY(Double_t dX, Double_t dY)
Set pad dimension (cm)
void SetPadCharge(Double_t charge)
Set the calibrated charge.
Double_t GetBendingCoor() const
return bending coordinate (cm)
virtual Float_t ValueAsFloatFast(Int_t i, Int_t j=0) const =0
Same as above but without bound checking.
void LoadEvent(AliESDEvent &esdEvent, Bool_t refit=kTRUE)
static void ResetTracker(const AliMUONRecoParam *recoParam=0x0, Bool_t info=kTRUE)
virtual Int_t ADC() const =0
Raw ADC value of this digit.
void SetClusterCharge(Double_t charge)
Set the total cluster charge.
void SetClusterChi2(Double_t clusterChi2)
set cluster Chi2
virtual Double_t GetErrX() const =0
Return resolution (cm) on coordinate X.
TIterator * CreateTrackIterator() const
void SetPadPlaneType(Int_t planeType)
Set the plane type 0=Bending 1=NonBending.
Track parameters in ALICE dimuon spectrometer.
void SetPadADC(Int_t adc)
Set the raw charge.
void SetTrackChi2(Double_t trackChi2)
set track Chi2
virtual void Clear(Option_t *opt="")=0
Clear container.
Class with MUON reconstruction parameters.
void SetZ(Double_t z)
Set cluster/track Z-position (cm)
virtual Float_t Charge() const =0
The charge of this digit, calibrated or not depending on IsCalibrated()
virtual Bool_t IsCalibrated() const =0
Whether this digit has been calibrated or not (see note 1 in AliMUONVDigit.cxx)
virtual AliMpPad PadByIndices(Int_t ix, Int_t iy, Bool_t warning=true) const =0
Find pad by indices.
virtual Int_t DetElemId() const =0
The detection element this digit belongs to.
virtual UInt_t GetDigitId(Int_t i) const =0
Return Id of digits i.
Container of calibration values for a given number of channels.
Double_t GetBendingSlope() const
return bending slope (cm ** -1)
abstract base class for clusters
Double_t GetCharge() const
return the charge (assumed forward motion)
virtual AliMUONVDigitStore * Create() const =0
Create an (empty) object of the same concrete class as *this.
virtual AliMUONVStore * Create() const =0
Create an empty copy of this.
void SetClusterXYErr(Double_t xErr, Double_t yErr)
Set cluster resolution (cm)
virtual void Clear(Option_t *opt="")
virtual Int_t Cathode() const =0
Cathode number this digit is on (0 or 1)
void SetTrackThetaXY(Double_t thetaX, Double_t thetaY)
Set track angles (radian)
Converter between MUON track/cluster/digit and ESDMuon track/cluster/pad.
Double_t GetPositionY() const
Return the pad x position (in cm)
virtual Double_t GetErrY() const =0
Return resolution (cm) on coordinate Y.
void SetSaturated(Bool_t saturated=kTRUE)
Set the pad as being saturated or not.
void SetTrackP(Double_t p)
Set track momentum (MeV/c)
virtual Int_t GetNDigits() const =0
Return number of associated digits.
Interface of a cluster container.
void SetEventId(Int_t eventId)
set event number
virtual Double_t GetChi2() const =0
Return chi2 of cluster.
virtual AliMUONVCluster * FindObject(const TObject *object) const
Find an object.
AliMp::CathodType GetCathodType(Int_t cathodNumber)
Convert integer number in enum;.
virtual AliMUONVCluster * Remove(AliMUONVCluster &cluster)=0
Remove a cluster object to the store.
virtual Int_t PadX() const =0
The x-index of this digit (>=0)
AliMUONVStore * Pedestals() const
Get the pedestal store.
void SetTrackId(UInt_t trackId)
set track ID
void SetTrackXY(Double_t x, Double_t y)
Set track coordinates (cm)
AliMUONCalibrationData * calibData
static Int_t GetChamberId(UInt_t uniqueID)
Return chamber id (0..), part of the uniqueID.
virtual Double_t GetY() const =0
Return coordinate Y (cm)
TTree * GetESDTree(TFile *esdFile)
Single entry point to access MUON calibration data.
void SetTrackXYErr(Double_t xErr, Double_t yErr)
Set track resolution (cm)
void SetRunId(Int_t runId)
set run number
The abstract base class for the segmentation.
Double_t GetDimensionY() const
Return the y pad dimension - half length (in cm)
UInt_t buildClusterMap(AliMUONTrack &track)
void SetPadId(UInt_t padId)
Set pad ID.
Double_t GetNonBendingCoor() const
return non bending coordinate (cm)
virtual Int_t ManuId() const =0
The electronic card id this digit belongs to (manuId for tracker, localboardId for trigger) ...
AliMUONVCluster * GetClusterPtr() const
get pointeur to associated cluster
Class which encapsuate all information about a pad.
virtual Bool_t IsSaturated() const =0
Whether the ADC has saturated.
virtual Double_t GetX() const =0
Return coordinate X (cm)
void SetTrackChamberHitMap(UInt_t trackChamberHitMap)
Set the map of hit chambers.
virtual void Clear(Option_t *opt="")=0
Clear ourselves (i.e. Reset)
Double_t GetPositionX() const
Return the pad x position (in cm)
AliMUONVDigitStore * GetDigits() const
Return internal track store.
Reconstructed track in ALICE dimuon spectrometer.
virtual AliMUONVDigit * FindObject(const TObject *object) const
Find an object (default is to forward to FindObject(object->GetUniqueID())
Class to summarize ESD data at cluster.
Bool_t LoadMapping(Bool_t segmentationOnly=kFALSE)
virtual Double_t GetCharge() const =0
Set the cluster charge.
virtual TIterator * CreateIterator() const =0
Return an iterator to loop over the whole store.
Class to summarize ESD data at pad.
Double_t GetDimensionX() const
Return the x pad dimension - half length (in cm)
virtual Bool_t Connect(TTree &tree, Bool_t alone=kTRUE) const
Connect us to a TTree (only valid if CanConnect()==kTRUE)
void AddPad(const AliMUONPadInfo &pad)
attach a pad to the cluster
const TMatrixD & GetCovariances() const
void SetTrackCharge(Short_t charge)
Set the muon charge.
void MUONClusterInfo(Int_t nevents=-1, const char *esdFileName="AliESDs.root", const char *inFileName="galice.root", const TString ocdbPath="local://$ALICE_ROOT/OCDB", const char *outFileName="clusterInfo.root")
void SetClusterId(UInt_t clusterId)
set cluster ID
static Int_t ManuMask(AliMp::PlaneType planeType)
AliMUONRecoParam * LoadRecoParam()
TObjArray * GetTrackParamAtCluster() const
void SetPadXY(Double_t x, Double_t y)
Set pad coordinates (cm)
Double_t GetNonBendingSlope() const
return non bending slope (cm ** -1)