1 /***************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Conributors 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 "AliCDBStorage.h"
30 #include "AliCDBEntry.h"
31 #include "AliITSClusterFinder.h"
32 #include "AliITSClusterFinderV2.h"
33 #include "AliITSClusterFinderV2SPD.h"
34 #include "AliITSClusterFinderV2SDD.h"
35 #include "AliITSClusterFinderV2SSD.h"
36 #include "AliITSClusterFinderSPD.h"
37 #include "AliITSClusterFinderSDD.h"
38 #include "AliITSClusterFinderSSD.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(),
77 // Default Constructor
83 // A properly zero-ed AliITSDetTypeRec class.
85 for(Int_t i=0; i<3; i++){
86 fClusterClassName[i]=0;
88 fRecPointClassName[i]=0;
95 //________________________________________________________________
96 AliITSDetTypeRec::AliITSDetTypeRec(AliITSLoader *loader): TObject(),
113 // Standard Constructor
121 fReconstruction = new TObjArray(fgkNdettypes);
122 fDigits = new TObjArray(fgkNdettypes);
123 for(Int_t i=0; i<3; i++){
124 fClusterClassName[i]=0;
126 fRecPointClassName[i]=0;
128 fNdtype = new Int_t[fgkNdettypes];
129 fCtype = new TObjArray(fgkNdettypes);
130 fNctype = new Int_t[fgkNdettypes];
131 fNMod = new Int_t [fgkNdettypes];
132 fNMod[0] = fgkDefaultNModulesSPD;
133 fNMod[1] = fgkDefaultNModulesSDD;
134 fNMod[2] = fgkDefaultNModulesSSD;
135 fRecPoints = new TClonesArray("AliITSRecPoint",3000);
138 for(Int_t i=0;i<fgkNdettypes;i++){
147 //______________________________________________________________________
148 AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec & rec):TObject(rec),
150 fReconstruction(rec.fReconstruction),
151 fSegmentation(rec.fSegmentation),
152 fCalibration(rec.fCalibration),
153 fPreProcess(rec.fPreProcess),
154 fPostProcess(rec.fPostProcess),
155 fDigits(rec.fDigits),
156 fNdtype(rec.fNdtype),
158 fNctype(rec.fNctype),
159 fRecPoints(rec.fRecPoints),
160 fNRecPoints(rec.fNRecPoints),
161 fSelectedVertexer(rec.fSelectedVertexer),
162 fLoader(rec.fLoader),
163 fRunNumber(rec.fRunNumber),
164 fFirstcall(rec.fFirstcall)
170 //______________________________________________________________________
171 AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& source){
172 // Assignment operator.
173 this->~AliITSDetTypeRec();
174 new(this) AliITSDetTypeRec(source);
179 //_____________________________________________________________________
180 AliITSDetTypeRec::~AliITSDetTypeRec(){
184 fReconstruction->Delete();
185 delete fReconstruction;
189 fSegmentation->Delete();
190 delete fSegmentation;
193 if(fCalibration && fRunNumber<0){
194 AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD()))->GetResponse();
195 AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSDD()))->GetResponse();
196 AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD()))->GetResponse();
197 if(rspd) delete rspd;
198 if(rsdd) delete rsdd;
199 if(rssd) delete rssd;
200 fCalibration->Delete();
204 if(fPreProcess) delete fPreProcess;
205 if(fPostProcess) delete fPostProcess;
213 fRecPoints->Delete();
225 if(fLoader) delete fLoader;
229 //___________________________________________________________________
230 void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){
232 //Set reconstruction model for detector type
234 if(fReconstruction==0) fReconstruction = new TObjArray(fgkNdettypes);
235 if(fReconstruction->At(dettype)!=0) delete fReconstruction->At(dettype);
236 fReconstruction->AddAt(clf,dettype);
238 //______________________________________________________________________
239 AliITSClusterFinder* AliITSDetTypeRec::GetReconstructionModel(Int_t dettype){
241 //Get reconstruction model for detector type
242 if(fReconstruction==0) {
243 Warning("GetReconstructionModel","fReconstruction is 0!");
246 return (AliITSClusterFinder*)fReconstruction->At(dettype);
249 //______________________________________________________________________
250 void AliITSDetTypeRec::SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg){
252 //Set segmentation model for detector type
254 if(fSegmentation==0) fSegmentation = new TObjArray(fgkNdettypes);
255 if(fSegmentation->At(dettype)!=0) delete fSegmentation->At(dettype);
256 fSegmentation->AddAt(seg,dettype);
259 //______________________________________________________________________
260 AliITSsegmentation* AliITSDetTypeRec::GetSegmentationModel(Int_t dettype){
262 //Get segmentation model for detector type
264 if(fSegmentation==0) {
265 Warning("GetSegmentationModel","fSegmentation is 0!");
268 return (AliITSsegmentation*)fSegmentation->At(dettype);
271 //_______________________________________________________________________
272 void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSCalibration *cal){
274 //Set calibration (response) for the module iMod of type dettype
275 if (fCalibration==0) {
276 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
277 fCalibration->SetOwner(kTRUE);
278 fCalibration->Clear();
281 if (fCalibration->At(iMod) != 0)
282 delete (AliITSCalibration*) fCalibration->At(iMod);
283 fCalibration->AddAt(cal,iMod);
286 //_______________________________________________________________________
287 AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
289 //Get calibration model for module type
291 if(fCalibration==0) {
292 Warning("GetalibrationModel","fCalibration is 0!");
296 return (AliITSCalibration*)fCalibration->At(iMod);
299 //______________________________________________________________________
300 void AliITSDetTypeRec::SetTreeAddress(){
301 // Set branch address for the Trees.
303 TTree *treeR = fLoader->TreeR();
304 TTree *treeD = fLoader->TreeD();
306 SetTreeAddressD(treeD);
307 SetTreeAddressR(treeR);
309 //______________________________________________________________________
310 void AliITSDetTypeRec::SetTreeAddressD(TTree *treeD){
311 // Set branch address for the tree of digits.
313 const char *det[4] = {"SPD","SDD","SSD","ITS"};
320 if (fDigits == 0x0) fDigits = new TObjArray(fgkNdettypes);
321 for (i=0; i<fgkNdettypes; i++) {
322 digclass = GetDigitClassName(i);
323 if(!(fDigits->At(i))) {
324 fDigits->AddAt(new TClonesArray(digclass,1000),i);
328 if (fgkNdettypes==3) sprintf(branchname,"%sDigits%s",det[3],det[i]);
329 else sprintf(branchname,"%sDigits%d",det[3],i+1);
331 branch = treeD->GetBranch(branchname);
332 if (branch) branch->SetAddress(&((*fDigits)[i]));
337 //_______________________________________________________________________
338 TBranch* AliITSDetTypeRec::MakeBranchInTree(TTree *tree, const char* name,
339 const char *classname,
340 void* address,Int_t size,
341 Int_t splitlevel, const char */*file*/)
344 // Makes branch in given tree and diverts them to a separate file
350 Error("MakeBranchInTree","Making Branch %s Tree is NULL",name);
353 TBranch *branch = tree->GetBranch(name);
358 branch = tree->Branch(name,classname,address,size,splitlevel);
361 branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel);
367 //____________________________________________________________________
368 void AliITSDetTypeRec::SetDefaults(){
370 //Set defaults for segmentation and response
373 Warning("SetDefaults","null pointer to AliITSgeomGeom !");
377 AliITSsegmentation* seg;
378 if(!GetCalibration()) {AliFatal("Exit");exit(0);}
380 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
382 seg = new AliITSsegmentationSPD(GetITSgeom());
383 SetSegmentationModel(dettype,seg);
384 SetDigitClassName(dettype,"AliITSdigitSPD");
385 SetClusterClassName(dettype,"AliITSRawClusterSPD");
389 AliITSCalibrationSDD* res=(AliITSCalibrationSDD*) GetCalibrationModel(GetITSgeom()->GetStartSDD());
390 seg = new AliITSsegmentationSDD(GetITSgeom(),res);
391 SetSegmentationModel(dettype,seg);
392 const char *kopt = ((AliITSresponseSDD*)res->GetResponse())->ZeroSuppOption();
393 if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) SetDigitClassName(dettype,"AliITSdigit");
394 else SetDigitClassName(dettype,"AliITSdigitSDD");
395 SetClusterClassName(dettype,"AliITSRawClusterSDD");
399 AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(GetITSgeom());
400 seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
401 seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
402 seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
403 SetSegmentationModel(dettype,seg2);
404 SetDigitClassName(dettype,"AliITSdigitSSD");
405 SetClusterClassName(dettype,"AliITSRawClusterSSD");
410 //______________________________________________________________________
411 Bool_t AliITSDetTypeRec::GetCalibration() {
412 // Get Default calibration if a storage is not defined.
415 AliITSCalibration* cal = GetCalibrationModel(0);
422 SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun());
423 Int_t run=GetRunNumber();
425 Bool_t origCacheStatus = AliCDBManager::Instance()->GetCacheFlag();
426 Bool_t isCacheActive = kTRUE;
427 if(GetRunNumber()<0)isCacheActive=kFALSE;
428 if (fCalibration==0) {
429 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
430 fCalibration->SetOwner(isCacheActive);
431 fCalibration->Clear();
434 AliCDBManager::Instance()->SetCacheFlag(isCacheActive);
436 AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", run);
437 AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", run);
438 AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", run);
439 AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", run);
440 AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", run);
441 AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", run);
443 if(!entrySPD || !entrySDD || !entrySSD || !entry2SPD || !entry2SDD || !entry2SSD){
444 AliFatal("Calibration object retrieval failed! ");
448 TObjArray *calSPD = (TObjArray *)entrySPD->GetObject();
449 if(!isCacheActive)entrySPD->SetObject(NULL);
450 entrySPD->SetOwner(kTRUE);
452 AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject();
453 if(!isCacheActive)entry2SPD->SetObject(NULL);
454 entry2SPD->SetOwner(kTRUE);
456 TObjArray *calSDD = (TObjArray *)entrySDD->GetObject();
457 if(!isCacheActive)entrySDD->SetObject(NULL);
458 entrySDD->SetOwner(kTRUE);
460 AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject();
461 if(!isCacheActive)entry2SDD->SetObject(NULL);
462 entry2SDD->SetOwner(kTRUE);
464 TObjArray *calSSD = (TObjArray *)entrySSD->GetObject();
465 if(!isCacheActive)entrySSD->SetObject(NULL);
466 entrySSD->SetOwner(kTRUE);
468 AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject();
469 if(!isCacheActive)entry2SSD->SetObject(NULL);
470 entry2SSD->SetOwner(kTRUE);
472 // DB entries are deleted. In this way metadeta objects are deleted as well
482 AliCDBManager::Instance()->SetCacheFlag(origCacheStatus);
484 if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!calSSD)) {
485 AliWarning("Can not get calibration from calibration database !");
489 fNMod[0] = calSPD->GetEntries();
490 fNMod[1] = calSDD->GetEntries();
491 fNMod[2] = calSSD->GetEntries();
492 AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database",
493 fNMod[0], fNMod[1], fNMod[2]));
494 AliITSCalibration* cal;
495 for (Int_t i=0; i<fNMod[0]; i++) {
496 cal = (AliITSCalibration*) calSPD->At(i);
497 cal->SetResponse((AliITSresponse*)pSPD);
498 SetCalibrationModel(i, cal);
500 for (Int_t i=0; i<fNMod[1]; i++) {
501 cal = (AliITSCalibration*) calSDD->At(i);
502 cal->SetResponse((AliITSresponse*)pSDD);
503 Int_t iMod = i + fNMod[0];
504 SetCalibrationModel(iMod, cal);
506 for (Int_t i=0; i<fNMod[2]; i++) {
507 cal = (AliITSCalibration*) calSSD->At(i);
508 cal->SetResponse((AliITSresponse*)pSSD);
509 Int_t iMod = i + fNMod[0] + fNMod[1];
510 SetCalibrationModel(iMod, cal);
517 //________________________________________________________________
518 void AliITSDetTypeRec::SetDefaultClusterFinders(){
520 //set defaults for standard cluster finder
523 Warning("SetDefaults","null pointer to AliITSgeom!");
527 AliITSClusterFinder *clf;
531 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
534 if(!GetReconstructionModel(dettype)){
535 TClonesArray *dig0 = DigitsAddress(0);
536 TClonesArray *rec0 = ClustersAddress(0);
537 clf = new AliITSClusterFinderSPD(this,dig0,rec0);
538 SetReconstructionModel(dettype,clf);
545 if(!GetReconstructionModel(dettype)){
546 TClonesArray *dig1 = DigitsAddress(1);
547 TClonesArray *rec1 = ClustersAddress(1);
548 clf = new AliITSClusterFinderSDD(this,dig1,rec1);
549 SetReconstructionModel(dettype,clf);
555 if(!GetReconstructionModel(dettype)){
556 TClonesArray* dig2 = DigitsAddress(2);
557 clf = new AliITSClusterFinderSSD(this,dig2);
558 SetReconstructionModel(dettype,clf);
567 //________________________________________________________________
568 void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){
570 //Set defaults for cluster finder V2
573 Warning("SetDefaults","Null pointer to AliITSgeom !");
577 AliITSClusterFinder *clf;
580 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
583 if(!GetReconstructionModel(dettype)){
584 clf = new AliITSClusterFinderV2SPD(this);
586 if(!rawdata) clf->SetDigits(DigitsAddress(0));
587 SetReconstructionModel(dettype,clf);
593 if(!GetReconstructionModel(dettype)){
594 clf = new AliITSClusterFinderV2SDD(this);
596 if(!rawdata) clf->SetDigits(DigitsAddress(1));
597 SetReconstructionModel(dettype,clf);
604 if(!GetReconstructionModel(dettype)){
605 clf = new AliITSClusterFinderV2SSD(this);
607 if(!rawdata) clf->SetDigits(DigitsAddress(2));
608 SetReconstructionModel(dettype,clf);
615 //______________________________________________________________________
616 void AliITSDetTypeRec::MakeBranch(Option_t* option){
618 //Creates branches for clusters and recpoints
619 Bool_t cR = (strstr(option,"R")!=0);
620 Bool_t cRF = (strstr(option,"RF")!=0);
624 if(cR) MakeBranchR(0);
625 if(cRF) MakeBranchRF(0);
629 //_____________________________________________________________
630 void AliITSDetTypeRec::MakeTreeC(){
632 //Create a separate tree to store the clusters
634 Warning("MakeTreeC","ITS loader is null!");
637 if(fLoader->TreeC()== 0x0) fLoader->MakeTree("C");
641 //______________________________________________________________
642 void AliITSDetTypeRec::MakeBranchC(){
644 //Make branches in the tree of clusters
647 Warning("MakeBranchC","ITS loader is null!");
650 TTree* lTC = fLoader->TreeC();
652 Error("MakeTreeC","Can not get TreeC from loader");
656 Int_t buffersize = 4000;
657 Char_t branchname[30];
659 const char *det[4]={"SPD","SDD","SSD","ITS"};
661 for(Int_t i=0;i<fgkNdettypes;i++){
662 cluclass = GetClusterClassName(i);
663 if(fCtype==0x0) fCtype = new TObjArray(fgkNdettypes);
664 if(!ClustersAddress(i)){
665 fCtype->AddAt(new TClonesArray(cluclass,1000),i);
667 if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]);
668 else sprintf(branchname,"%sClusters%d",det[3],i+1);
670 if(lTC->GetBranch(branchname)){
671 Warning("MakeBranchC","Branch %s already exists in TreeC",branchname);
673 Info("MakeBranchC","Creating branch %s in TreeC",branchname);
674 lTC->Branch(branchname,&((*fCtype)[i]),buffersize);
682 //_______________________________________________________________
683 void AliITSDetTypeRec::GetTreeC(Int_t event){
685 //Get the clusters tree for this event and
686 //sets the branch address
690 Warning("GetTreeC","ITS loader is null!");
694 Char_t branchname[30];
695 const char *det[4] = {"SPD","SDD","SSD","ITS"};
696 TTree* lTC = fLoader->TreeC();
699 if(lTC) fLoader->CleanRawClusters();
704 for(Int_t i=0;i<fgkNdettypes;i++){
705 cluclass = GetClusterClassName(i);
706 if(fCtype==0x0) fCtype = new TObjArray(fgkNdettypes);
707 if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(cluclass,1000),i);
708 if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]);
709 else sprintf(branchname,"%sClusters%d",det[3],i+1);
711 branch = lTC->GetBranch(branchname);
712 if(branch) branch->SetAddress(&((*fCtype)[i]));
716 Error("GetTreeC","cannot find clusters Tree for vent %d",event);
721 //___________________________________________________________________
722 void AliITSDetTypeRec::AddCluster(Int_t id, AliITSRawCluster *c){
724 // Adds a raw cluster to the list
725 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
728 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
731 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
734 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
738 //___________________________________________________________________
739 void AliITSDetTypeRec::ResetDigits(){
740 // Reset number of digits and the digits array for the ITS detector.
743 for(Int_t i=0;i<fgkNdettypes;i++){
747 //___________________________________________________________________
748 void AliITSDetTypeRec::ResetDigits(Int_t branch){
749 // Reset number of digits and the digits array for this branch.
751 if(fDigits->At(branch)) ((TClonesArray*)fDigits->At(branch))->Clear();
752 if(fNdtype) fNdtype[branch]=0;
756 //__________________________________________________________________
757 void AliITSDetTypeRec::ResetClusters(){
759 //Resets number of clusters and the cluster array
760 for(Int_t i=0;i<fgkNdettypes;i++){
765 //__________________________________________________________________
766 void AliITSDetTypeRec::ResetClusters(Int_t i){
768 //Resets number of clusters and the cluster array for this branch
770 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
771 if (fNctype) fNctype[i]=0;
773 //__________________________________________________________________
774 void AliITSDetTypeRec::MakeBranchR(const char *file, Option_t *opt){
776 //Creates tree branches for recpoints
778 // cont char *file File name where RecPoints branch is to be written
779 // to. If blank it write the SDigits to the same
780 // file in which the Hits were found.
783 Warning("MakeBranchR","ITS loader is null!");
790 // only one branch for rec points for all detector types
791 Bool_t oFast= (strstr(opt,"Fast")!=0);
793 Char_t detname[10] = "ITS";
797 sprintf(branchname,"%sRecPointsF",detname);
799 sprintf(branchname,"%sRecPoints",detname);
802 if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
803 if (fLoader->TreeR()) {
804 if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",
806 MakeBranchInTree(fLoader->TreeR(),branchname,0,&fRecPoints,buffsz,99,file);
811 //______________________________________________________________________
812 void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){
813 // Set branch address for the Reconstructed points Trees.
815 // TTree *treeR Tree containing the RecPoints.
821 Char_t namedet[10]="ITS";
824 if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
826 sprintf(branchname,"%sRecPoints",namedet);
827 branch = treeR->GetBranch(branchname);
829 branch->SetAddress(&fRecPoints);
831 sprintf(branchname,"%sRecPointsF",namedet);
832 branch = treeR->GetBranch(branchname);
834 branch->SetAddress(&fRecPoints);
839 //____________________________________________________________________
840 void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){
841 // Add a reconstructed space point to the list
843 // const AliITSRecPoint &r RecPoint class to be added to the tree
844 // of reconstructed points TreeR.
850 TClonesArray &lrecp = *fRecPoints;
851 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
854 //______________________________________________________________________
855 void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt, Bool_t v2){
856 // cluster finding and reconstruction of space points
857 // the condition below will disappear when the geom class will be
858 // initialized for all versions - for the moment it is only for v5 !
859 // 7 is the SDD beam test version
861 // Int_t evNumber Event number to be processed.
862 // Int_t lastentry Offset for module when not all of the modules
864 // Option_t *opt String indicating which ITS sub-detectors should
865 // be processed. If ="All" then all of the ITS
866 // sub detectors are processed.
869 Warning("DigitsToRecPoints","Null pointer to AliITSgeom !");
873 Warning("DigitsToRecPoints","ITS loader is null!");
877 const char *all = strstr(opt,"All");
878 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
881 SetDefaultClusterFinders();
882 AliInfo("Original cluster finder has been selected\n");
885 SetDefaultClusterFindersV2();
886 AliInfo("V2 cluster finder has been selected \n");
889 TTree *treeC=fLoader->TreeC();
894 AliITSClusterFinder *rec = 0;
895 Int_t id,module,first=0;
896 for(module=0;module<GetITSgeom()->GetIndexMax();module++){
897 id = GetITSgeom()->GetModuleType(module);
898 if (!all && !det[id]) continue;
899 if(det[id]) first = GetITSgeom()->GetStartDet(id);
900 rec = (AliITSClusterFinder*)GetReconstructionModel(id);
901 TClonesArray *itsDigits = DigitsAddress(id);
903 Error("DigitsToRecPoints",
904 "The reconstruction class was not instanciated! event=%d",
909 TTree *lTD = fLoader->TreeD();
911 lTD->GetEvent(lastentry+module);
913 lTD->GetEvent(lastentry+(module-first));
915 Int_t ndigits = itsDigits->GetEntriesFast();
917 rec->SetDetTypeRec(this);
918 rec->SetDigits(DigitsAddress(id));
919 rec->SetClusters(ClustersAddress(id));
920 rec->FindRawClusters(module);
922 fLoader->TreeR()->Fill();
928 fLoader->WriteRecPoints("OVERWRITE");
929 fLoader->WriteRawClusters("OVERWRITE");
931 //______________________________________________________________________
932 void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){
933 // cluster finding and reconstruction of space points
934 // the condition below will disappear when the geom class will be
935 // initialized for all versions - for the moment it is only for v5 !
936 // 7 is the SDD beam test version
938 // Int_t evNumber Event number to be processed.
939 // Int_t lastentry Offset for module when not all of the modules
941 // Option_t *opt String indicating which ITS sub-detectors should
942 // be processed. If ="All" then all of the ITS
943 // sub detectors are processed.
949 Warning("DigitsToRecPoints","Null pointer to AliITSgeom !");
953 Warning("DigitsToRecPoints","ITS loader is null!");
958 AliITSClusterFinderV2 *rec = 0;
961 if(!fLoader->TreeR()) fLoader->MakeTree("R");
962 TTree* cTree = fLoader->TreeR();
963 TClonesArray *array=new TClonesArray("AliITSRecPoint",1000);
964 cTree->Branch("ITSRecPoints",&array);
967 TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()];
968 for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) {
969 clusters[iModule] = NULL;
972 rec = (AliITSClusterFinderV2*)GetReconstructionModel(id);
973 rec->SetDetTypeRec(this);
975 AliFatal("The reconstruction class was not instanciated");
977 rec->RawdataToClusters(rawReader,clusters);
980 TClonesArray *emptyArray=new TClonesArray("AliITSRecPoint");
981 for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
982 array = clusters[iModule];
984 AliDebug(1,Form("data for module %d missing!",iModule));
987 cTree->SetBranchAddress("ITSRecPoints",&array);
989 nClusters+=array->GetEntriesFast();
993 fLoader->WriteRecPoints("OVERWRITE");
996 Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n",