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 **************************************************************************/
20 ////////////////////////////////////////////////////////////////////////
21 // This class defines the "Standard" reconstruction for the ITS //
24 ////////////////////////////////////////////////////////////////////////
25 #include "TObjArray.h"
28 #include "AliCDBManager.h"
29 #include "AliCDBEntry.h"
30 #include "AliITSClusterFinder.h"
31 #include "AliITSClusterFinderV2.h"
32 #include "AliITSClusterFinderV2SPD.h"
33 #include "AliITSClusterFinderV2SDD.h"
34 #include "AliITSClusterFinderV2SSD.h"
35 #include "AliITSClusterFinderSPD.h"
36 #include "AliITSClusterFinderSDD.h"
37 #include "AliITSClusterFinderSSD.h"
38 #include "AliITSgeom.h"
39 #include "AliITSDetTypeRec.h"
40 #include "AliITSRawCluster.h"
41 #include "AliITSRawClusterSPD.h"
42 #include "AliITSRawClusterSDD.h"
43 #include "AliITSRawClusterSSD.h"
44 #include "AliITSRecPoint.h"
45 #include "AliITSCalibrationSDD.h"
46 #include "AliITSsegmentationSPD.h"
47 #include "AliITSsegmentationSDD.h"
48 #include "AliITSsegmentationSSD.h"
52 const Int_t AliITSDetTypeRec::fgkNdettypes = 3;
53 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSPD = 240;
54 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSDD = 260;
55 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSSD = 1698;
57 ClassImp(AliITSDetTypeRec)
59 //________________________________________________________________
60 AliITSDetTypeRec::AliITSDetTypeRec(): TObject(),
62 fReconstruction(),// [NDet]
63 fSegmentation(), // [NDet]
64 fCalibration(), // [NMod]
65 fPreProcess(), // [] e.g. Find Calibration values
66 fPostProcess(), // [] e.g. find primary vertex
67 fDigits(), //! [NMod][NDigits]
68 fClusterClassName(), // String with Cluster class name
69 fDigClassName(), // String with digit class name.
70 fRecPointClassName(){// String with RecPoint class name
71 // Default Constructor
77 // A properly zero-ed AliITSDetTypeRec class.
80 fReconstruction = new TObjArray(fgkNdettypes);
85 fDigits = new TObjArray(fgkNdettypes);
86 fNdtype = new Int_t[fgkNdettypes];
87 fCtype = new TObjArray(fgkNdettypes);
88 fNctype = new Int_t[fgkNdettypes];
89 fRecPoints = new TClonesArray("AliITSRecPoint",3000);
92 for(Int_t i=0;i<fgkNdettypes;i++){
100 fNMod[0] = fgkDefaultNModulesSPD;
101 fNMod[1] = fgkDefaultNModulesSDD;
102 fNMod[2] = fgkDefaultNModulesSSD;
106 //______________________________________________________________________
107 AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec &/*rec*/):TObject(/*rec*/){
110 Error("Copy constructor","Copy constructor not allowed");
113 //______________________________________________________________________
114 AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& /*source*/){
115 // Assignment operator. This is a function which is not allowed to be
117 Error("operator=","Assignment operator not allowed\n");
121 //_____________________________________________________________________
122 AliITSDetTypeRec::~AliITSDetTypeRec(){
127 fReconstruction->Delete();
128 delete fReconstruction;
132 fSegmentation->Delete();
133 delete fSegmentation;
137 AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSPD()))->GetResponse();
138 AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSDD()))->GetResponse();
139 AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(fGeom->GetStartSSD()))->GetResponse();
140 if(rspd) delete rspd;
141 if(rsdd) delete rsdd;
142 if(rssd) delete rssd;
143 fCalibration->Delete();
147 if(fGeom) delete fGeom;
148 if(fPreProcess) delete fPreProcess;
149 if(fPostProcess) delete fPostProcess;
157 fRecPoints->Delete();
168 if(fLoader) delete fLoader;
171 //___________________________________________________________________
172 void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){
174 //Set reconstruction model for detector type
176 if(fReconstruction==0) fReconstruction = new TObjArray(fgkNdettypes);
177 if(fReconstruction->At(dettype)!=0) delete fReconstruction->At(dettype);
178 fReconstruction->AddAt(clf,dettype);
180 //______________________________________________________________________
181 AliITSClusterFinder* AliITSDetTypeRec::GetReconstructionModel(Int_t dettype){
183 //Get reconstruction model for detector type
184 if(fReconstruction==0) {
185 Warning("GetReconstructionModel","fReconstruction is 0!");
188 return (AliITSClusterFinder*)fReconstruction->At(dettype);
191 //______________________________________________________________________
192 void AliITSDetTypeRec::SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg){
194 //Set segmentation model for detector type
196 if(fSegmentation==0) fSegmentation = new TObjArray(fgkNdettypes);
197 if(fSegmentation->At(dettype)!=0) delete fSegmentation->At(dettype);
198 fSegmentation->AddAt(seg,dettype);
201 //______________________________________________________________________
202 AliITSsegmentation* AliITSDetTypeRec::GetSegmentationModel(Int_t dettype){
204 //Get segmentation model for detector type
206 if(fSegmentation==0) {
207 Warning("GetSegmentationModel","fSegmentation is 0!");
210 return (AliITSsegmentation*)fSegmentation->At(dettype);
213 //_______________________________________________________________________
214 void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSCalibration *cal){
216 //Set calibration (response) for the module iMod of type dettype
217 if (fCalibration==0) {
218 fCalibration = new TObjArray(fGeom->GetIndexMax());
219 fCalibration->SetOwner(kTRUE);
220 fCalibration->Clear();
223 if (fCalibration->At(iMod) != 0)
224 delete (AliITSCalibration*) fCalibration->At(iMod);
225 fCalibration->AddAt(cal,iMod);
228 //_______________________________________________________________________
229 AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
231 //Get calibration model for module type
233 if(fCalibration==0) {
234 Warning("GetalibrationModel","fCalibration is 0!");
238 return (AliITSCalibration*)fCalibration->At(iMod);
241 //______________________________________________________________________
242 void AliITSDetTypeRec::SetTreeAddress(){
243 // Set branch address for the Trees.
245 TTree *treeR = fLoader->TreeR();
246 TTree *treeD = fLoader->TreeD();
248 SetTreeAddressD(treeD);
249 SetTreeAddressR(treeR);
251 //______________________________________________________________________
252 void AliITSDetTypeRec::SetTreeAddressD(TTree *treeD){
253 // Set branch address for the tree of digits.
255 const char *det[4] = {"SPD","SDD","SSD","ITS"};
262 if (fDigits == 0x0) fDigits = new TObjArray(fgkNdettypes);
263 for (i=0; i<fgkNdettypes; i++) {
264 digclass = GetDigitClassName(i);
265 if(!(fDigits->At(i))) {
266 fDigits->AddAt(new TClonesArray(digclass,1000),i);
270 if (fgkNdettypes==3) sprintf(branchname,"%sDigits%s",det[3],det[i]);
271 else sprintf(branchname,"%sDigits%d",det[3],i+1);
273 branch = treeD->GetBranch(branchname);
274 if (branch) branch->SetAddress(&((*fDigits)[i]));
279 //_______________________________________________________________________
280 TBranch* AliITSDetTypeRec::MakeBranchInTree(TTree *tree, const char* name,
281 const char *classname,
282 void* address,Int_t size,
283 Int_t splitlevel, const char */*file*/)
286 // Makes branch in given tree and diverts them to a separate file
292 Error("MakeBranchInTree","Making Branch %s Tree is NULL",name);
295 TBranch *branch = tree->GetBranch(name);
300 branch = tree->Branch(name,classname,address,size,splitlevel);
303 branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel);
309 //____________________________________________________________________
310 void AliITSDetTypeRec::SetDefaults(){
312 //Set defaults for segmentation and response
315 Warning("SetDefaults","fGeom is 0!");
319 AliITSsegmentation* seg;
320 if(!GetCalibration()) {AliFatal("Exit");exit(0);}
322 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
324 seg = new AliITSsegmentationSPD(fGeom);
325 SetSegmentationModel(dettype,seg);
326 SetDigitClassName(dettype,"AliITSdigitSPD");
327 SetClusterClassName(dettype,"AliITSRawClusterSPD");
331 AliITSCalibrationSDD* res=(AliITSCalibrationSDD*) GetCalibrationModel(fGeom->GetStartSDD());
332 seg = new AliITSsegmentationSDD(fGeom,res);
333 SetSegmentationModel(dettype,seg);
334 const char *kopt = ((AliITSresponseSDD*)res->GetResponse())->ZeroSuppOption();
335 if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) SetDigitClassName(dettype,"AliITSdigit");
336 else SetDigitClassName(dettype,"AliITSdigitSDD");
337 SetClusterClassName(dettype,"AliITSRawClusterSDD");
341 AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(fGeom);
342 seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
343 seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
344 seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
345 SetSegmentationModel(dettype,seg2);
346 SetDigitClassName(dettype,"AliITSdigitSSD");
347 SetClusterClassName(dettype,"AliITSRawClusterSSD");
352 //______________________________________________________________________
353 Bool_t AliITSDetTypeRec::GetCalibration() {
354 // Get Default calibration if a storage is not defined.
357 AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", fRunNumber);
358 AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", fRunNumber);
359 AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", fRunNumber);
360 AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", fRunNumber);
361 AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", fRunNumber);
362 AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", fRunNumber);
364 if(!entrySPD || !entrySDD || !entrySSD || !entry2SPD || !entry2SDD || !entry2SSD){
365 AliWarning("Calibration object retrieval failed! Dummy calibration will be used.");
366 AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
367 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
369 entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", fRunNumber);
370 entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", fRunNumber);
371 entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", fRunNumber);
372 entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", fRunNumber);
373 entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", fRunNumber);
374 entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", fRunNumber);
376 AliCDBManager::Instance()->SetDefaultStorage(origStorage);
380 TObjArray *respSPD = (TObjArray *)entrySPD->GetObject();
381 entrySPD->SetObject(NULL);
382 entrySPD->SetOwner(kTRUE);
384 AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject();
385 entry2SPD->SetObject(NULL);
386 entry2SPD->SetOwner(kTRUE);
388 TObjArray *respSDD = (TObjArray *)entrySDD->GetObject();
389 entrySDD->SetObject(NULL);
390 entrySDD->SetOwner(kTRUE);
392 AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject();
393 entry2SDD->SetObject(NULL);
394 entry2SDD->SetOwner(kTRUE);
396 TObjArray *respSSD = (TObjArray *)entrySSD->GetObject();
397 entrySSD->SetObject(NULL);
398 entrySSD->SetOwner(kTRUE);
400 AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject();
401 entry2SSD->SetObject(NULL);
402 entry2SSD->SetOwner(kTRUE);
404 // DB entries are dleted. In this waymetadeta objects are deleted as well
413 if ((!pSPD)||(!pSDD)||(!pSSD) || (!respSPD) || (!respSDD) || (!respSSD)) {
414 AliWarning("Can not get calibration from calibration database !");
418 fNMod[0] = respSPD->GetEntries();
419 fNMod[1] = respSDD->GetEntries();
420 fNMod[2] = respSSD->GetEntries();
421 AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database",
422 fNMod[0], fNMod[1], fNMod[2]));
423 AliITSCalibration* res;
424 for (Int_t i=0; i<fNMod[0]; i++) {
425 res = (AliITSCalibration*) respSPD->At(i);
426 res->SetResponse((AliITSresponse*)pSPD);
427 SetCalibrationModel(i, res);
429 for (Int_t i=0; i<fNMod[1]; i++) {
430 res = (AliITSCalibration*) respSDD->At(i);
431 res->SetResponse((AliITSresponse*)pSDD);
432 Int_t iMod = i + fNMod[0];
433 SetCalibrationModel(iMod, res);
435 for (Int_t i=0; i<fNMod[2]; i++) {
436 res = (AliITSCalibration*) respSSD->At(i);
437 res->SetResponse((AliITSresponse*)pSSD);
438 Int_t iMod = i + fNMod[0] + fNMod[1];
439 SetCalibrationModel(iMod, res);
446 //________________________________________________________________
447 void AliITSDetTypeRec::SetDefaultClusterFinders(){
449 //set defaults for standard cluster finder
452 Warning("SetDefaults","fGeom is 0!");
456 AliITSClusterFinder *clf;
460 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
463 if(!GetReconstructionModel(dettype)){
464 TClonesArray *dig0 = DigitsAddress(0);
465 TClonesArray *rec0 = ClustersAddress(0);
466 clf = new AliITSClusterFinderSPD(this,dig0,rec0);
467 SetReconstructionModel(dettype,clf);
474 if(!GetReconstructionModel(dettype)){
475 TClonesArray *dig1 = DigitsAddress(1);
476 TClonesArray *rec1 = ClustersAddress(1);
477 clf = new AliITSClusterFinderSDD(this,dig1,rec1);
478 SetReconstructionModel(dettype,clf);
484 if(!GetReconstructionModel(dettype)){
485 TClonesArray* dig2 = DigitsAddress(2);
486 clf = new AliITSClusterFinderSSD(this,dig2);
487 SetReconstructionModel(dettype,clf);
496 //________________________________________________________________
497 void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){
499 //Set defaults for cluster finder V2
502 Warning("SetDefaults","fGeom is 0!");
506 AliITSClusterFinder *clf;
509 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
512 if(!GetReconstructionModel(dettype)){
513 clf = new AliITSClusterFinderV2SPD(this);
515 if(!rawdata) clf->SetDigits(DigitsAddress(0));
516 SetReconstructionModel(dettype,clf);
522 if(!GetReconstructionModel(dettype)){
523 clf = new AliITSClusterFinderV2SDD(this);
525 if(!rawdata) clf->SetDigits(DigitsAddress(1));
526 SetReconstructionModel(dettype,clf);
533 if(!GetReconstructionModel(dettype)){
534 clf = new AliITSClusterFinderV2SSD(this);
536 if(!rawdata) clf->SetDigits(DigitsAddress(2));
537 SetReconstructionModel(dettype,clf);
544 //______________________________________________________________________
545 void AliITSDetTypeRec::MakeBranch(Option_t* option){
547 //Creates branches for clusters and recpoints
548 Bool_t cR = (strstr(option,"R")!=0);
549 Bool_t cRF = (strstr(option,"RF")!=0);
553 if(cR) MakeBranchR(0);
554 if(cRF) MakeBranchRF(0);
558 //_____________________________________________________________
559 void AliITSDetTypeRec::MakeTreeC(){
561 //Create a separate tree to store the clusters
563 Warning("MakeTreeC","ITS loader is null!");
566 if(fLoader->TreeC()== 0x0) fLoader->MakeTree("C");
570 //______________________________________________________________
571 void AliITSDetTypeRec::MakeBranchC(){
573 //Make branches in the tree of clusters
576 Warning("MakeBranchC","ITS loader is null!");
579 TTree* lTC = fLoader->TreeC();
581 Error("MakeTreeC","Can not get TreeC from loader");
585 Int_t buffersize = 4000;
586 Char_t branchname[30];
588 const char *det[4]={"SPD","SDD","SSD","ITS"};
590 for(Int_t i=0;i<fgkNdettypes;i++){
591 cluclass = GetClusterClassName(i);
592 if(fCtype==0x0) fCtype = new TObjArray(fgkNdettypes);
593 if(!ClustersAddress(i)){
594 fCtype->AddAt(new TClonesArray(cluclass,1000),i);
596 if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]);
597 else sprintf(branchname,"%sClusters%d",det[3],i+1);
599 if(lTC->GetBranch(branchname)){
600 Warning("MakeBranchC","Branch %s already exists in TreeC",branchname);
602 Info("MakeBranchC","Creating branch %s in TreeC",branchname);
603 lTC->Branch(branchname,&((*fCtype)[i]),buffersize);
611 //_______________________________________________________________
612 void AliITSDetTypeRec::GetTreeC(Int_t event){
614 //Get the clusters tree for this event and
615 //sets the branch address
619 Warning("GetTreeC","ITS loader is null!");
623 Char_t branchname[30];
624 const char *det[4] = {"SPD","SDD","SSD","ITS"};
625 TTree* lTC = fLoader->TreeC();
628 if(lTC) fLoader->CleanRawClusters();
633 for(Int_t i=0;i<fgkNdettypes;i++){
634 cluclass = GetClusterClassName(i);
635 if(fCtype==0x0) fCtype = new TObjArray(fgkNdettypes);
636 if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(cluclass,1000),i);
637 if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]);
638 else sprintf(branchname,"%sClusters%d",det[3],i+1);
640 branch = lTC->GetBranch(branchname);
641 if(branch) branch->SetAddress(&((*fCtype)[i]));
645 Error("GetTreeC","cannot find clusters Tree for vent %d",event);
650 //___________________________________________________________________
651 void AliITSDetTypeRec::AddCluster(Int_t id, AliITSRawCluster *c){
653 // Adds a raw cluster to the list
654 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
657 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
660 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
663 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
667 //___________________________________________________________________
668 void AliITSDetTypeRec::ResetDigits(){
669 // Reset number of digits and the digits array for the ITS detector.
672 for(Int_t i=0;i<fgkNdettypes;i++){
676 //___________________________________________________________________
677 void AliITSDetTypeRec::ResetDigits(Int_t branch){
678 // Reset number of digits and the digits array for this branch.
680 if(fDigits->At(branch)) ((TClonesArray*)fDigits->At(branch))->Clear();
681 if(fNdtype) fNdtype[branch]=0;
685 //__________________________________________________________________
686 void AliITSDetTypeRec::ResetClusters(){
688 //Resets number of clusters and the cluster array
689 for(Int_t i=0;i<fgkNdettypes;i++){
694 //__________________________________________________________________
695 void AliITSDetTypeRec::ResetClusters(Int_t i){
697 //Resets number of clusters and the cluster array for this branch
699 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
700 if (fNctype) fNctype[i]=0;
702 //__________________________________________________________________
703 void AliITSDetTypeRec::MakeBranchR(const char *file, Option_t *opt){
705 //Creates tree branches for recpoints
707 // cont char *file File name where RecPoints branch is to be written
708 // to. If blank it write the SDigits to the same
709 // file in which the Hits were found.
712 Warning("MakeBranchR","ITS loader is null!");
719 // only one branch for rec points for all detector types
720 Bool_t oFast= (strstr(opt,"Fast")!=0);
722 Char_t detname[10] = "ITS";
726 sprintf(branchname,"%sRecPointsF",detname);
728 sprintf(branchname,"%sRecPoints",detname);
731 if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
732 if (fLoader->TreeR()) {
733 if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",
735 MakeBranchInTree(fLoader->TreeR(),branchname,0,&fRecPoints,buffsz,99,file);
740 //______________________________________________________________________
741 void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){
742 // Set branch address for the Reconstructed points Trees.
744 // TTree *treeR Tree containing the RecPoints.
750 Char_t namedet[10]="ITS";
753 if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
755 sprintf(branchname,"%sRecPoints",namedet);
756 branch = treeR->GetBranch(branchname);
758 branch->SetAddress(&fRecPoints);
760 sprintf(branchname,"%sRecPointsF",namedet);
761 branch = treeR->GetBranch(branchname);
763 branch->SetAddress(&fRecPoints);
768 //____________________________________________________________________
769 void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){
770 // Add a reconstructed space point to the list
772 // const AliITSRecPoint &r RecPoint class to be added to the tree
773 // of reconstructed points TreeR.
779 TClonesArray &lrecp = *fRecPoints;
780 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
783 //______________________________________________________________________
784 void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt, Bool_t v2){
785 // cluster finding and reconstruction of space points
786 // the condition below will disappear when the geom class will be
787 // initialized for all versions - for the moment it is only for v5 !
788 // 7 is the SDD beam test version
790 // Int_t evNumber Event number to be processed.
791 // Int_t lastentry Offset for module when not all of the modules
793 // Option_t *opt String indicating which ITS sub-detectors should
794 // be processed. If ="All" then all of the ITS
795 // sub detectors are processed.
798 Warning("DigitsToRecPoints","fGeom is null!");
802 Warning("DigitsToRecPoints","ITS loader is null!");
806 const char *all = strstr(opt,"All");
807 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
810 SetDefaultClusterFinders();
811 AliInfo("Original cluster finder has been selected\n");
814 SetDefaultClusterFindersV2();
815 AliInfo("V2 cluster finder has been selected \n");
818 TTree *treeC=fLoader->TreeC();
823 AliITSClusterFinder *rec = 0;
824 Int_t id,module,first=0;
825 for(module=0;module<fGeom->GetIndexMax();module++){
826 id = fGeom->GetModuleType(module);
827 if (!all && !det[id]) continue;
828 if(det[id]) first = fGeom->GetStartDet(id);
829 rec = (AliITSClusterFinder*)GetReconstructionModel(id);
830 TClonesArray *itsDigits = DigitsAddress(id);
832 Error("DigitsToRecPoints",
833 "The reconstruction class was not instanciated! event=%d",
838 TTree *lTD = fLoader->TreeD();
840 lTD->GetEvent(lastentry+module);
842 lTD->GetEvent(lastentry+(module-first));
844 Int_t ndigits = itsDigits->GetEntriesFast();
846 rec->SetDetTypeRec(this);
847 rec->SetDigits(DigitsAddress(id));
848 rec->SetClusters(ClustersAddress(id));
849 rec->FindRawClusters(module);
851 fLoader->TreeR()->Fill();
857 fLoader->WriteRecPoints("OVERWRITE");
858 fLoader->WriteRawClusters("OVERWRITE");
860 //______________________________________________________________________
861 void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){
862 // cluster finding and reconstruction of space points
863 // the condition below will disappear when the geom class will be
864 // initialized for all versions - for the moment it is only for v5 !
865 // 7 is the SDD beam test version
867 // Int_t evNumber Event number to be processed.
868 // Int_t lastentry Offset for module when not all of the modules
870 // Option_t *opt String indicating which ITS sub-detectors should
871 // be processed. If ="All" then all of the ITS
872 // sub detectors are processed.
878 Warning("DigitsToRecPoints","fGeom is null!");
882 Warning("DigitsToRecPoints","ITS loader is null!");
887 AliITSClusterFinderV2 *rec = 0;
890 if(!fLoader->TreeR()) fLoader->MakeTree("R");
891 TTree* cTree = fLoader->TreeR();
892 TClonesArray *array=new TClonesArray("AliITSRecPoint",1000);
893 cTree->Branch("ITSRecPoints",&array);
896 TClonesArray** clusters = new TClonesArray*[fGeom->GetIndexMax()];
897 for (Int_t iModule = 0; iModule < fGeom->GetIndexMax(); iModule++) {
898 clusters[iModule] = NULL;
901 rec = (AliITSClusterFinderV2*)GetReconstructionModel(id);
902 rec->SetDetTypeRec(this);
904 Error("DigitsToRecPoints",
905 "The reconstruction class was not instanciated");
908 rec->RawdataToClusters(rawReader,clusters);
911 for(Int_t iModule=0;iModule<fGeom->GetIndexMax();iModule++){
912 array = clusters[iModule];
914 Error("DigitsToRecPoints","data for module %d missing!",iModule);
915 array = new TClonesArray("AliITSRecPoint");
917 cTree->SetBranchAddress("ITSRecPoints",&array);
919 nClusters+=array->GetEntriesFast();
922 fLoader->WriteRecPoints("OVERWRITE");
925 Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n",