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 "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 "AliITSDetTypeRec.h"
39 #include "AliITSRawCluster.h"
40 #include "AliITSRawClusterSPD.h"
41 #include "AliITSRawClusterSDD.h"
42 #include "AliITSRawClusterSSD.h"
43 #include "AliITSRecPoint.h"
44 #include "AliITSCalibrationSDD.h"
45 #include "AliITSsegmentationSPD.h"
46 #include "AliITSsegmentationSDD.h"
47 #include "AliITSsegmentationSSD.h"
51 const Int_t AliITSDetTypeRec::fgkNdettypes = 3;
52 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSPD = 240;
53 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSDD = 260;
54 const Int_t AliITSDetTypeRec::fgkDefaultNModulesSSD = 1698;
56 ClassImp(AliITSDetTypeRec)
58 //________________________________________________________________
59 AliITSDetTypeRec::AliITSDetTypeRec(): TObject(),
76 // Default Constructor
82 // A properly zero-ed AliITSDetTypeRec class.
84 for(Int_t i=0; i<3; i++){
85 fClusterClassName[i]=0;
87 fRecPointClassName[i]=0;
94 //________________________________________________________________
95 AliITSDetTypeRec::AliITSDetTypeRec(AliITSLoader *loader): TObject(),
112 // Standard Constructor
120 fReconstruction = new TObjArray(fgkNdettypes);
121 fDigits = new TObjArray(fgkNdettypes);
122 for(Int_t i=0; i<3; i++){
123 fClusterClassName[i]=0;
125 fRecPointClassName[i]=0;
127 fNdtype = new Int_t[fgkNdettypes];
128 fCtype = new TObjArray(fgkNdettypes);
129 fNctype = new Int_t[fgkNdettypes];
130 fNMod = new Int_t [fgkNdettypes];
131 fNMod[0] = fgkDefaultNModulesSPD;
132 fNMod[1] = fgkDefaultNModulesSDD;
133 fNMod[2] = fgkDefaultNModulesSSD;
134 fRecPoints = new TClonesArray("AliITSRecPoint",3000);
137 for(Int_t i=0;i<fgkNdettypes;i++){
146 //______________________________________________________________________
147 AliITSDetTypeRec::AliITSDetTypeRec(const AliITSDetTypeRec & rec):TObject(rec)
151 Error("Copy constructor","Copy constructor not allowed");
153 //______________________________________________________________________
154 AliITSDetTypeRec& AliITSDetTypeRec::operator=(const AliITSDetTypeRec& source){
155 // Assignment operator. This is a function which is not allowed to be
157 Error("operator=","Assignment operator not allowed\n");
162 //_____________________________________________________________________
163 AliITSDetTypeRec::~AliITSDetTypeRec(){
167 fReconstruction->Delete();
168 delete fReconstruction;
172 fSegmentation->Delete();
173 delete fSegmentation;
176 if(fCalibration && fRunNumber<0){
177 AliITSresponse* rspd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSPD()))->GetResponse();
178 AliITSresponse* rsdd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSDD()))->GetResponse();
179 AliITSresponse* rssd = ((AliITSCalibration*)fCalibration->At(GetITSgeom()->GetStartSSD()))->GetResponse();
180 if(rspd) delete rspd;
181 if(rsdd) delete rsdd;
182 if(rssd) delete rssd;
183 fCalibration->Delete();
187 if(fPreProcess) delete fPreProcess;
188 if(fPostProcess) delete fPostProcess;
196 fRecPoints->Delete();
208 if(fLoader) delete fLoader;
212 //___________________________________________________________________
213 void AliITSDetTypeRec::SetReconstructionModel(Int_t dettype,AliITSClusterFinder *clf){
215 //Set reconstruction model for detector type
217 if(fReconstruction==0) fReconstruction = new TObjArray(fgkNdettypes);
218 if(fReconstruction->At(dettype)!=0) delete fReconstruction->At(dettype);
219 fReconstruction->AddAt(clf,dettype);
221 //______________________________________________________________________
222 AliITSClusterFinder* AliITSDetTypeRec::GetReconstructionModel(Int_t dettype){
224 //Get reconstruction model for detector type
225 if(fReconstruction==0) {
226 Warning("GetReconstructionModel","fReconstruction is 0!");
229 return (AliITSClusterFinder*)fReconstruction->At(dettype);
232 //______________________________________________________________________
233 void AliITSDetTypeRec::SetSegmentationModel(Int_t dettype,AliITSsegmentation *seg){
235 //Set segmentation model for detector type
237 if(fSegmentation==0) fSegmentation = new TObjArray(fgkNdettypes);
238 if(fSegmentation->At(dettype)!=0) delete fSegmentation->At(dettype);
239 fSegmentation->AddAt(seg,dettype);
242 //______________________________________________________________________
243 AliITSsegmentation* AliITSDetTypeRec::GetSegmentationModel(Int_t dettype){
245 //Get segmentation model for detector type
247 if(fSegmentation==0) {
248 Warning("GetSegmentationModel","fSegmentation is 0!");
251 return (AliITSsegmentation*)fSegmentation->At(dettype);
254 //_______________________________________________________________________
255 void AliITSDetTypeRec::SetCalibrationModel(Int_t iMod, AliITSCalibration *cal){
257 //Set calibration (response) for the module iMod of type dettype
258 if (fCalibration==0) {
259 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
260 fCalibration->SetOwner(kTRUE);
261 fCalibration->Clear();
264 if (fCalibration->At(iMod) != 0)
265 delete (AliITSCalibration*) fCalibration->At(iMod);
266 fCalibration->AddAt(cal,iMod);
269 //_______________________________________________________________________
270 AliITSCalibration* AliITSDetTypeRec::GetCalibrationModel(Int_t iMod){
272 //Get calibration model for module type
274 if(fCalibration==0) {
275 Warning("GetalibrationModel","fCalibration is 0!");
279 return (AliITSCalibration*)fCalibration->At(iMod);
282 //______________________________________________________________________
283 void AliITSDetTypeRec::SetTreeAddress(){
284 // Set branch address for the Trees.
286 TTree *treeR = fLoader->TreeR();
287 TTree *treeD = fLoader->TreeD();
289 SetTreeAddressD(treeD);
290 SetTreeAddressR(treeR);
292 //______________________________________________________________________
293 void AliITSDetTypeRec::SetTreeAddressD(TTree *treeD){
294 // Set branch address for the tree of digits.
296 const char *det[4] = {"SPD","SDD","SSD","ITS"};
303 if (fDigits == 0x0) fDigits = new TObjArray(fgkNdettypes);
304 for (i=0; i<fgkNdettypes; i++) {
305 digclass = GetDigitClassName(i);
306 if(!(fDigits->At(i))) {
307 fDigits->AddAt(new TClonesArray(digclass,1000),i);
311 if (fgkNdettypes==3) sprintf(branchname,"%sDigits%s",det[3],det[i]);
312 else sprintf(branchname,"%sDigits%d",det[3],i+1);
314 branch = treeD->GetBranch(branchname);
315 if (branch) branch->SetAddress(&((*fDigits)[i]));
320 //_______________________________________________________________________
321 TBranch* AliITSDetTypeRec::MakeBranchInTree(TTree *tree, const char* name,
322 const char *classname,
323 void* address,Int_t size,
324 Int_t splitlevel, const char */*file*/)
327 // Makes branch in given tree and diverts them to a separate file
333 Error("MakeBranchInTree","Making Branch %s Tree is NULL",name);
336 TBranch *branch = tree->GetBranch(name);
341 branch = tree->Branch(name,classname,address,size,splitlevel);
344 branch = tree->Bronch(name, "TClonesArray", address, size, splitlevel);
350 //____________________________________________________________________
351 void AliITSDetTypeRec::SetDefaults(){
353 //Set defaults for segmentation and response
356 Warning("SetDefaults","null pointer to AliITSgeomGeom !");
360 AliITSsegmentation* seg;
361 if(!GetCalibration()) {AliFatal("Exit");exit(0);}
363 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
365 seg = new AliITSsegmentationSPD(GetITSgeom());
366 SetSegmentationModel(dettype,seg);
367 SetDigitClassName(dettype,"AliITSdigitSPD");
368 SetClusterClassName(dettype,"AliITSRawClusterSPD");
372 AliITSCalibrationSDD* res=(AliITSCalibrationSDD*) GetCalibrationModel(GetITSgeom()->GetStartSDD());
373 seg = new AliITSsegmentationSDD(GetITSgeom(),res);
374 SetSegmentationModel(dettype,seg);
375 const char *kopt = ((AliITSresponseSDD*)res->GetResponse())->ZeroSuppOption();
376 if((!strstr(kopt,"2D"))&&(!strstr(kopt,"1D"))) SetDigitClassName(dettype,"AliITSdigit");
377 else SetDigitClassName(dettype,"AliITSdigitSDD");
378 SetClusterClassName(dettype,"AliITSRawClusterSDD");
382 AliITSsegmentationSSD* seg2 = new AliITSsegmentationSSD(GetITSgeom());
383 seg2->SetAngles(0.0075,0.0275); // strip angels rad P and N side.
384 seg2->SetAnglesLay5(0.0075,0.0275); // strip angels rad P and N side.
385 seg2->SetAnglesLay6(0.0275,0.0075); // strip angels rad P and N side.
386 SetSegmentationModel(dettype,seg2);
387 SetDigitClassName(dettype,"AliITSdigitSSD");
388 SetClusterClassName(dettype,"AliITSRawClusterSSD");
393 //______________________________________________________________________
394 Bool_t AliITSDetTypeRec::GetCalibration() {
395 // Get Default calibration if a storage is not defined.
398 AliITSCalibration* cal = GetCalibrationModel(0);
405 SetRunNumber((Int_t)AliCDBManager::Instance()->GetRun());
406 Int_t run=GetRunNumber();
407 if(run<0)run=0; // if the run number is not yet set, use fake run # 0
409 Bool_t origCacheStatus = AliCDBManager::Instance()->GetCacheFlag();
410 Bool_t isCacheActive = kTRUE;
411 if(GetRunNumber()<0)isCacheActive=kFALSE;
412 if (fCalibration==0) {
413 fCalibration = new TObjArray(GetITSgeom()->GetIndexMax());
414 fCalibration->SetOwner(isCacheActive);
415 fCalibration->Clear();
418 AliCDBManager::Instance()->SetCacheFlag(isCacheActive);
420 AliCDBEntry *entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", run);
421 AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", run);
422 AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", run);
423 AliCDBEntry *entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", run);
424 AliCDBEntry *entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", run);
425 AliCDBEntry *entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", run);
427 if(!entrySPD || !entrySDD || !entrySSD || !entry2SPD || !entry2SDD || !entry2SSD){
428 AliWarning("Calibration object retrieval failed! Dummy calibration will be used.");
429 AliCDBStorage *origStorage = AliCDBManager::Instance()->GetDefaultStorage();
430 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
432 entrySPD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSPD", run);
433 entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", run);
434 entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", run);
435 entry2SPD = AliCDBManager::Instance()->Get("ITS/Calib/RespSPD", run);
436 entry2SDD = AliCDBManager::Instance()->Get("ITS/Calib/RespSDD", run);
437 entry2SSD = AliCDBManager::Instance()->Get("ITS/Calib/RespSSD", run);
439 AliCDBManager::Instance()->SetDefaultStorage(origStorage);
443 TObjArray *calSPD = (TObjArray *)entrySPD->GetObject();
444 if(!isCacheActive)entrySPD->SetObject(NULL);
445 entrySPD->SetOwner(kTRUE);
447 AliITSresponseSPD *pSPD = (AliITSresponseSPD*)entry2SPD->GetObject();
448 if(!isCacheActive)entry2SPD->SetObject(NULL);
449 entry2SPD->SetOwner(kTRUE);
451 TObjArray *calSDD = (TObjArray *)entrySDD->GetObject();
452 if(!isCacheActive)entrySDD->SetObject(NULL);
453 entrySDD->SetOwner(kTRUE);
455 AliITSresponseSDD *pSDD = (AliITSresponseSDD*)entry2SDD->GetObject();
456 if(!isCacheActive)entry2SDD->SetObject(NULL);
457 entry2SDD->SetOwner(kTRUE);
459 TObjArray *calSSD = (TObjArray *)entrySSD->GetObject();
460 if(!isCacheActive)entrySSD->SetObject(NULL);
461 entrySSD->SetOwner(kTRUE);
463 AliITSresponseSSD *pSSD = (AliITSresponseSSD*)entry2SSD->GetObject();
464 if(!isCacheActive)entry2SSD->SetObject(NULL);
465 entry2SSD->SetOwner(kTRUE);
467 // DB entries are deleted. In this way metadeta objects are deleted as well
477 AliCDBManager::Instance()->SetCacheFlag(origCacheStatus);
479 if ((!pSPD)||(!pSDD)||(!pSSD) || (!calSPD) || (!calSDD) || (!calSSD)) {
480 AliWarning("Can not get calibration from calibration database !");
484 fNMod[0] = calSPD->GetEntries();
485 fNMod[1] = calSDD->GetEntries();
486 fNMod[2] = calSSD->GetEntries();
487 AliInfo(Form("%i SPD, %i SDD and %i SSD in calibration database",
488 fNMod[0], fNMod[1], fNMod[2]));
489 AliITSCalibration* cal;
490 for (Int_t i=0; i<fNMod[0]; i++) {
491 cal = (AliITSCalibration*) calSPD->At(i);
492 cal->SetResponse((AliITSresponse*)pSPD);
493 SetCalibrationModel(i, cal);
495 for (Int_t i=0; i<fNMod[1]; i++) {
496 cal = (AliITSCalibration*) calSDD->At(i);
497 cal->SetResponse((AliITSresponse*)pSDD);
498 Int_t iMod = i + fNMod[0];
499 SetCalibrationModel(iMod, cal);
501 for (Int_t i=0; i<fNMod[2]; i++) {
502 cal = (AliITSCalibration*) calSSD->At(i);
503 cal->SetResponse((AliITSresponse*)pSSD);
504 Int_t iMod = i + fNMod[0] + fNMod[1];
505 SetCalibrationModel(iMod, cal);
512 //________________________________________________________________
513 void AliITSDetTypeRec::SetDefaultClusterFinders(){
515 //set defaults for standard cluster finder
518 Warning("SetDefaults","null pointer to AliITSgeom!");
522 AliITSClusterFinder *clf;
526 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
529 if(!GetReconstructionModel(dettype)){
530 TClonesArray *dig0 = DigitsAddress(0);
531 TClonesArray *rec0 = ClustersAddress(0);
532 clf = new AliITSClusterFinderSPD(this,dig0,rec0);
533 SetReconstructionModel(dettype,clf);
540 if(!GetReconstructionModel(dettype)){
541 TClonesArray *dig1 = DigitsAddress(1);
542 TClonesArray *rec1 = ClustersAddress(1);
543 clf = new AliITSClusterFinderSDD(this,dig1,rec1);
544 SetReconstructionModel(dettype,clf);
550 if(!GetReconstructionModel(dettype)){
551 TClonesArray* dig2 = DigitsAddress(2);
552 clf = new AliITSClusterFinderSSD(this,dig2);
553 SetReconstructionModel(dettype,clf);
562 //________________________________________________________________
563 void AliITSDetTypeRec::SetDefaultClusterFindersV2(Bool_t rawdata){
565 //Set defaults for cluster finder V2
568 Warning("SetDefaults","Null pointer to AliITSgeom !");
572 AliITSClusterFinder *clf;
575 for(Int_t dettype=0;dettype<fgkNdettypes;dettype++){
578 if(!GetReconstructionModel(dettype)){
579 clf = new AliITSClusterFinderV2SPD(this);
581 if(!rawdata) clf->SetDigits(DigitsAddress(0));
582 SetReconstructionModel(dettype,clf);
588 if(!GetReconstructionModel(dettype)){
589 clf = new AliITSClusterFinderV2SDD(this);
591 if(!rawdata) clf->SetDigits(DigitsAddress(1));
592 SetReconstructionModel(dettype,clf);
599 if(!GetReconstructionModel(dettype)){
600 clf = new AliITSClusterFinderV2SSD(this);
602 if(!rawdata) clf->SetDigits(DigitsAddress(2));
603 SetReconstructionModel(dettype,clf);
610 //______________________________________________________________________
611 void AliITSDetTypeRec::MakeBranch(Option_t* option){
613 //Creates branches for clusters and recpoints
614 Bool_t cR = (strstr(option,"R")!=0);
615 Bool_t cRF = (strstr(option,"RF")!=0);
619 if(cR) MakeBranchR(0);
620 if(cRF) MakeBranchRF(0);
624 //_____________________________________________________________
625 void AliITSDetTypeRec::MakeTreeC(){
627 //Create a separate tree to store the clusters
629 Warning("MakeTreeC","ITS loader is null!");
632 if(fLoader->TreeC()== 0x0) fLoader->MakeTree("C");
636 //______________________________________________________________
637 void AliITSDetTypeRec::MakeBranchC(){
639 //Make branches in the tree of clusters
642 Warning("MakeBranchC","ITS loader is null!");
645 TTree* lTC = fLoader->TreeC();
647 Error("MakeTreeC","Can not get TreeC from loader");
651 Int_t buffersize = 4000;
652 Char_t branchname[30];
654 const char *det[4]={"SPD","SDD","SSD","ITS"};
656 for(Int_t i=0;i<fgkNdettypes;i++){
657 cluclass = GetClusterClassName(i);
658 if(fCtype==0x0) fCtype = new TObjArray(fgkNdettypes);
659 if(!ClustersAddress(i)){
660 fCtype->AddAt(new TClonesArray(cluclass,1000),i);
662 if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]);
663 else sprintf(branchname,"%sClusters%d",det[3],i+1);
665 if(lTC->GetBranch(branchname)){
666 Warning("MakeBranchC","Branch %s already exists in TreeC",branchname);
668 Info("MakeBranchC","Creating branch %s in TreeC",branchname);
669 lTC->Branch(branchname,&((*fCtype)[i]),buffersize);
677 //_______________________________________________________________
678 void AliITSDetTypeRec::GetTreeC(Int_t event){
680 //Get the clusters tree for this event and
681 //sets the branch address
685 Warning("GetTreeC","ITS loader is null!");
689 Char_t branchname[30];
690 const char *det[4] = {"SPD","SDD","SSD","ITS"};
691 TTree* lTC = fLoader->TreeC();
694 if(lTC) fLoader->CleanRawClusters();
699 for(Int_t i=0;i<fgkNdettypes;i++){
700 cluclass = GetClusterClassName(i);
701 if(fCtype==0x0) fCtype = new TObjArray(fgkNdettypes);
702 if(!fCtype->At(i)) fCtype->AddAt(new TClonesArray(cluclass,1000),i);
703 if(fgkNdettypes==3) sprintf(branchname,"%sClusters%s",det[3],det[i]);
704 else sprintf(branchname,"%sClusters%d",det[3],i+1);
706 branch = lTC->GetBranch(branchname);
707 if(branch) branch->SetAddress(&((*fCtype)[i]));
711 Error("GetTreeC","cannot find clusters Tree for vent %d",event);
716 //___________________________________________________________________
717 void AliITSDetTypeRec::AddCluster(Int_t id, AliITSRawCluster *c){
719 // Adds a raw cluster to the list
720 TClonesArray &lc = *((TClonesArray*)fCtype->At(id));
723 new(lc[fNctype[id]++]) AliITSRawClusterSPD(*((AliITSRawClusterSPD*)c));
726 new(lc[fNctype[id]++]) AliITSRawClusterSDD(*((AliITSRawClusterSDD*)c));
729 new(lc[fNctype[id]++]) AliITSRawClusterSSD(*((AliITSRawClusterSSD*)c));
733 //___________________________________________________________________
734 void AliITSDetTypeRec::ResetDigits(){
735 // Reset number of digits and the digits array for the ITS detector.
738 for(Int_t i=0;i<fgkNdettypes;i++){
742 //___________________________________________________________________
743 void AliITSDetTypeRec::ResetDigits(Int_t branch){
744 // Reset number of digits and the digits array for this branch.
746 if(fDigits->At(branch)) ((TClonesArray*)fDigits->At(branch))->Clear();
747 if(fNdtype) fNdtype[branch]=0;
751 //__________________________________________________________________
752 void AliITSDetTypeRec::ResetClusters(){
754 //Resets number of clusters and the cluster array
755 for(Int_t i=0;i<fgkNdettypes;i++){
760 //__________________________________________________________________
761 void AliITSDetTypeRec::ResetClusters(Int_t i){
763 //Resets number of clusters and the cluster array for this branch
765 if (fCtype->At(i)) ((TClonesArray*)fCtype->At(i))->Clear();
766 if (fNctype) fNctype[i]=0;
768 //__________________________________________________________________
769 void AliITSDetTypeRec::MakeBranchR(const char *file, Option_t *opt){
771 //Creates tree branches for recpoints
773 // cont char *file File name where RecPoints branch is to be written
774 // to. If blank it write the SDigits to the same
775 // file in which the Hits were found.
778 Warning("MakeBranchR","ITS loader is null!");
785 // only one branch for rec points for all detector types
786 Bool_t oFast= (strstr(opt,"Fast")!=0);
788 Char_t detname[10] = "ITS";
792 sprintf(branchname,"%sRecPointsF",detname);
794 sprintf(branchname,"%sRecPoints",detname);
797 if(!fRecPoints)fRecPoints = new TClonesArray("AliITSRecPoint",1000);
798 if (fLoader->TreeR()) {
799 if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",
801 MakeBranchInTree(fLoader->TreeR(),branchname,0,&fRecPoints,buffsz,99,file);
806 //______________________________________________________________________
807 void AliITSDetTypeRec::SetTreeAddressR(TTree *treeR){
808 // Set branch address for the Reconstructed points Trees.
810 // TTree *treeR Tree containing the RecPoints.
816 Char_t namedet[10]="ITS";
819 if(fRecPoints==0x0) fRecPoints = new TClonesArray("AliITSRecPoint",1000);
821 sprintf(branchname,"%sRecPoints",namedet);
822 branch = treeR->GetBranch(branchname);
824 branch->SetAddress(&fRecPoints);
826 sprintf(branchname,"%sRecPointsF",namedet);
827 branch = treeR->GetBranch(branchname);
829 branch->SetAddress(&fRecPoints);
834 //____________________________________________________________________
835 void AliITSDetTypeRec::AddRecPoint(const AliITSRecPoint &r){
836 // Add a reconstructed space point to the list
838 // const AliITSRecPoint &r RecPoint class to be added to the tree
839 // of reconstructed points TreeR.
845 TClonesArray &lrecp = *fRecPoints;
846 new(lrecp[fNRecPoints++]) AliITSRecPoint(r);
849 //______________________________________________________________________
850 void AliITSDetTypeRec::DigitsToRecPoints(Int_t evNumber,Int_t lastentry,Option_t *opt, Bool_t v2){
851 // cluster finding and reconstruction of space points
852 // the condition below will disappear when the geom class will be
853 // initialized for all versions - for the moment it is only for v5 !
854 // 7 is the SDD beam test version
856 // Int_t evNumber Event number to be processed.
857 // Int_t lastentry Offset for module when not all of the modules
859 // Option_t *opt String indicating which ITS sub-detectors should
860 // be processed. If ="All" then all of the ITS
861 // sub detectors are processed.
864 Warning("DigitsToRecPoints","Null pointer to AliITSgeom !");
868 Warning("DigitsToRecPoints","ITS loader is null!");
872 const char *all = strstr(opt,"All");
873 const char *det[3] = {strstr(opt,"SPD"),strstr(opt,"SDD"),
876 SetDefaultClusterFinders();
877 AliInfo("Original cluster finder has been selected\n");
880 SetDefaultClusterFindersV2();
881 AliInfo("V2 cluster finder has been selected \n");
884 TTree *treeC=fLoader->TreeC();
889 AliITSClusterFinder *rec = 0;
890 Int_t id,module,first=0;
891 for(module=0;module<GetITSgeom()->GetIndexMax();module++){
892 id = GetITSgeom()->GetModuleType(module);
893 if (!all && !det[id]) continue;
894 if(det[id]) first = GetITSgeom()->GetStartDet(id);
895 rec = (AliITSClusterFinder*)GetReconstructionModel(id);
896 TClonesArray *itsDigits = DigitsAddress(id);
898 Error("DigitsToRecPoints",
899 "The reconstruction class was not instanciated! event=%d",
904 TTree *lTD = fLoader->TreeD();
906 lTD->GetEvent(lastentry+module);
908 lTD->GetEvent(lastentry+(module-first));
910 Int_t ndigits = itsDigits->GetEntriesFast();
912 rec->SetDetTypeRec(this);
913 rec->SetDigits(DigitsAddress(id));
914 rec->SetClusters(ClustersAddress(id));
915 rec->FindRawClusters(module);
917 fLoader->TreeR()->Fill();
923 fLoader->WriteRecPoints("OVERWRITE");
924 fLoader->WriteRawClusters("OVERWRITE");
926 //______________________________________________________________________
927 void AliITSDetTypeRec::DigitsToRecPoints(AliRawReader* rawReader){
928 // cluster finding and reconstruction of space points
929 // the condition below will disappear when the geom class will be
930 // initialized for all versions - for the moment it is only for v5 !
931 // 7 is the SDD beam test version
933 // Int_t evNumber Event number to be processed.
934 // Int_t lastentry Offset for module when not all of the modules
936 // Option_t *opt String indicating which ITS sub-detectors should
937 // be processed. If ="All" then all of the ITS
938 // sub detectors are processed.
944 Warning("DigitsToRecPoints","Null pointer to AliITSgeom !");
948 Warning("DigitsToRecPoints","ITS loader is null!");
953 AliITSClusterFinderV2 *rec = 0;
956 if(!fLoader->TreeR()) fLoader->MakeTree("R");
957 TTree* cTree = fLoader->TreeR();
958 TClonesArray *array=new TClonesArray("AliITSRecPoint",1000);
959 cTree->Branch("ITSRecPoints",&array);
962 TClonesArray** clusters = new TClonesArray*[GetITSgeom()->GetIndexMax()];
963 for (Int_t iModule = 0; iModule < GetITSgeom()->GetIndexMax(); iModule++) {
964 clusters[iModule] = NULL;
967 rec = (AliITSClusterFinderV2*)GetReconstructionModel(id);
968 rec->SetDetTypeRec(this);
970 Error("DigitsToRecPoints",
971 "The reconstruction class was not instanciated");
974 rec->RawdataToClusters(rawReader,clusters);
977 for(Int_t iModule=0;iModule<GetITSgeom()->GetIndexMax();iModule++){
978 array = clusters[iModule];
980 Error("DigitsToRecPoints","data for module %d missing!",iModule);
981 array = new TClonesArray("AliITSRecPoint");
983 cTree->SetBranchAddress("ITSRecPoints",&array);
985 nClusters+=array->GetEntriesFast();
988 fLoader->WriteRecPoints("OVERWRITE");
991 Info("DigitsToRecPoints", "total number of found recpoints in ITS: %d\n",