+Bool_t AliMUONData::IsTriggerBranchesInTree()
+{
+ // Checking if there are Trigger Branches In TreeR
+ if (TreeR()==0x0) {
+ Error("TreeR","No treeR in memory");
+ return kFALSE;
+ }
+ else {
+ char branchname[30];
+ sprintf(branchname,"%sLocalTrigger",GetName());
+ TBranch * branch = 0x0;
+ branch = TreeR()->GetBranch(branchname);
+ if (branch) return kTRUE;
+ else return kFALSE;
+ }
+}
+//____________________________________________________________________________
+Bool_t AliMUONData::IsTrackBranchesInTree()
+{
+ // Checking if there are Track Branches In TreeT
+ if (TreeT()==0x0) {
+ Error("TreeT","No treeT in memory");
+ return kFALSE;
+ }
+ else {
+ char branchname[30];
+ sprintf(branchname,"%sTrack",GetName());
+ TBranch * branch = 0x0;
+ branch = TreeT()->GetBranch(branchname);
+ if (branch) return kTRUE;
+ else return kFALSE;
+ }
+}
+//____________________________________________________________________________
+Bool_t AliMUONData::IsTriggerTrackBranchesInTree()
+{
+ // Checking if there are TriggerTrack Branches In TreeT
+ if (TreeT()==0x0) {
+ Error("TreeT","No treeT in memory");
+ return kFALSE;
+ }
+ else {
+ char branchname[30];
+ sprintf(branchname,"%sTriggerTrack",GetName());
+ TBranch * branch = 0x0;
+ branch = TreeT()->GetBranch(branchname);
+ if (branch) return kTRUE;
+ else return kFALSE;
+ }
+}
+//____________________________________________________________________________
+void AliMUONData::Fill(Option_t* option)
+{
+ // Method to fill the trees
+ const char *cH = strstr(option,"H");
+ const char *cD = strstr(option,"D"); // Digits branches in TreeD
+ const char *cS = strstr(option,"S"); // SDigits branches in TreeS
+ const char *cRC = strstr(option,"RC"); // RawCluster branches in TreeR
+ const char *cGLT = strstr(option,"GLT"); // Global and Local Trigger branches in TreeR
+ const char *cRT = strstr(option,"RT"); // Reconstructed Track in TreeT
+ const char *cRL = strstr(option,"RL"); // Reconstructed Trigger Track in TreeT
+
+ //const char *cRP = strstr(option,"RP"); // Reconstructed Particle in TreeP
+
+ char branchname[30];
+ TBranch * branch = 0x0;
+
+ //
+ // Filling TreeH
+ if ( TreeH() && cH ) {
+ TreeH()->Fill();
+ }
+ //
+ // Filling TreeD
+ if ( TreeD() && cD) {
+ TreeD()->Fill();
+ }
+ // Filling TreeS
+ if ( TreeS() && cS) {
+ TreeS()->Fill();
+ }
+
+ //
+ // filling rawclusters
+ if ( TreeR() && cRC ) {
+ if ( IsTriggerBranchesInTree() ) {
+ // Branch per branch filling
+ for (int i=0; i<AliMUONConstants::NTrackingCh(); i++) {
+ sprintf(branchname,"%sRawClusters%d",GetName(),i+1);
+ branch = TreeR()->GetBranch(branchname);
+ branch->Fill();
+ }
+ }
+ else TreeR()->Fill();
+ }
+
+ //
+ // filling trigger
+ if ( TreeR() && cGLT) {
+ if (IsRawClusterBranchesInTree()) {
+ // Branch per branch filling
+ sprintf(branchname,"%sLocalTrigger",GetName());
+ branch = TreeR()->GetBranch(branchname);
+ branch->Fill();
+ sprintf(branchname,"%sGlobalTrigger",GetName());
+ branch = TreeR()->GetBranch(branchname);
+ branch->Fill();
+ }
+ else TreeR()->Fill();
+ }
+ //
+ // filling tracks
+ if ( TreeT() && cRT ) {
+ if (IsTriggerTrackBranchesInTree()) {
+ sprintf(branchname,"%sTrack",GetName());
+ branch = TreeT()->GetBranch(branchname);
+ branch->Fill();
+ }
+ else TreeT()->Fill();
+ }
+ // filling trigger tracks
+ if ( TreeT() && cRL ) {
+ if (IsTrackBranchesInTree()) {
+ sprintf(branchname,"%sTriggerTrack",GetName());
+ branch = TreeT()->GetBranch(branchname);
+ branch->Fill();
+ }
+ else TreeT()->Fill();
+ }
+// if ( TreeT() && cRL ) {
+// sprintf(branchname,"%sTrackTrig",GetName());
+// TreeT()->Fill();
+// }
+}
+//_____________________________________________________________________________